Regex split text

Input

The value is completed please check all are correct.456_ui is done.478_#bh is done.890_#la is done.345_#ab.Are you wish to proceed further

Output
Arrayofstring

456_ui
478_#bh
890_#la
345#ab

@Demo_User

Use Regex is matching pattern Activity and for each loop

Hi @Demo_User

You can use the below regular expression,

- Assign -> Input = "The value is completed please check all are correct.456_ui is done.478_#bh is done.890_#la is done.345_#ab.Are you wish to proceed further"
- Assign -> output_Arr = System.Text.RegularExpressions.Regex.Matches(Input.ToString(), "\d+_\#?\w+").Cast(Of System.Text.RegularExpressions.Match)().Select(Function(m) m.Value).ToArray()

Check the below image,

Check the below workflow,

Output -
image

Note - The Output_Arr is the Array of String Datatype variable.

Hope it helps!!

Hi @Demo_User

Input= "The value is completed please check all are correct.456_ui is done.478_#bh is done.890_#la is done.345_#ab.Are you wish to proceed further"

Output= System.Text.RegularExpressions.Regex.Matches(Input, "\d+_[a-zA-Z#]+").Cast(Of System.Text.RegularExpressions.Match)().Select(Function(m) m.Value).ToArray()

Message Box -> String.Join(vbcrlf,Output)

Output is of DataType Array(System.String)

Regards

can you please suggest for this
Input

The value is completed please check all are correct.abc-def_:def is done.hef-thi_:thi is done.mon-tues_:tues is done.wed-ice_:ice.Are you wish to proceed further

Output
Arrayofstring

abc-def_:def
hef-thi_:thi
mon-tues_:tues
wed-ice_:ice

can you please suggest for this
Input

The value is completed please check all are correct.abc-def_:def is done.hef-thi_:thi is done.mon-tues_:tues is done.wed-ice_:ice.Are you wish to proceed further

Output
Arrayofstring

abc-def_:def
hef-thi_:thi
mon-tues_:tues
wed-ice_:ice

Check on this

Hi @Demo_User

Please use below regex expression in assign activity:

Input = "The value is completed please check all are correct.456_ui is done.478_#bh is done.890_#la is done.345_#ab.Are you wish to proceed further"
LineItems = System.Text.RegularExpressions.Regex.Matches(Input,"\d+.?.?[a-z]+")

you can use the for each and loop through each item also.

Regards

Okay @Demo_User

You can use the below regular expressions,

- Assign -> Input = "The value is completed please check all are correct.abc-def_:def is done.hef-thi_:thi is done.mon-tues_:tues is done.wed-ice_:ice.Are you wish to proceed further"
- Assign -> output_Arr = System.Text.RegularExpressions.Regex.Matches(Input.ToString(), "[a-z]+\-[a-z]+_\:[a-z]+").Cast(Of System.Text.RegularExpressions.Match)().Select(Function(m) m.Value).ToArray()

Output -
image

Hope it helps!!

HI @Demo_User

Use the below in assign activities.

Input =  "The value is completed please check all are correct.abc-def_:def is done.hef-thi_:thi is done.mon-tues_:tues is done.wed-ice_:ice.Are you wish to proceed further"

LineItems = System.Text.RegularExpressions.Regex.Matches(Input,"[a-z]+\-[a-z]+.?.?[a-z]+")

You can loop through each value using for each if required.

Regards

Hi @Demo_User

Assign Str1="The value is completed please check all are correct.456_ui is done.478_#bh is done.890_#la is done.345_#ab.Are you wish to proceed further"

matches=System.Text.RegularExpressions.Regex.Matches(str1,"\d+_.[A-Za-z]+")

Use for each to convert to list and then convert to array


Hope it helps!!

Sorry First word is the combination of alphabet and digit
abc123-def_:def
hef567-thi_:thi
Could u please suggest

Okay @Demo_User

Here is the regex for it,

- Assign -> Input = "The value is completed please check all are correct.abc123-def_:def is done.hef567-thi_:thi is done.mon-tues_:tues is done.wed-ice_:ice.Are you wish to proceed further"

- Assign -> Output_Arr = System.Text.RegularExpressions.Regex.Matches(Input.ToString(), "[a-z]+[0-9]*\-[a-z]+_\:[a-z]+").Cast(Of System.Text.RegularExpressions.Match)().Select(Function(m) m.Value).ToArray()

Output -
image

Hope it helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.