I received a value from python as a string, and i want to extract specific string values starting with “SE_” from it
input - values are not present in a function & SE_134 function is error.
Output - SE_134
Received input will be vary i want to get specific string which start from "SE_
" ,
Thanks ,
Karthik Murugesan
Hi @Karthik_Murugesan ,
in your case when using matches
Or
System.Text.RegularExpressions.Regex.Match(yourText, “SE_\w+”).Value
regards,
Here you go with explanation
stroutput_matches = System.Text.RegularExpressions.Regex.Matches(Strinput.ToString, “(?=SE_)\w+”)
Cheers @Karthik_Murugesan
mkankatala
(Mahesh Kankatala)
6
Hi @Karthik_Murugesan
Use the regular expressions to extract the required output
System.Text.RegularExpressions.Regex.Match(yourstringinput.ToString,"([A-Z_0-9]+)").Value
Hope it helps!!
Please try this @Karthik_Murugesan
(SE)_\d+

Can also go with this:(SE_)\w+

Hi @Karthik_Murugesan
if your input is constant then you can use this like SE_134
(?:SE)[0-9_]+
Note : rest two will not match because of that it has not SE_ Constant
If your input is not constant you can use this then it i will work
\w+\_[0-9]+
Let me know its working or not
@Karthik_Murugesan
@Karthik_Murugesan
System.Text.RegularExpressions.Regex.Match(InputStr,“SE_\d+”).Value
HopeItHelps!!!
If your input is not constant expersion not working it give error in UiPath
can you share the input of yours once or else sample of multiple text
@Karthik_Murugesan
input we receive like - No Values Present in Lighting Inventory Sheet or SE_503&No Values Present in empty Inventory Sheet & BE_503
we receive input like this we want extract which is start with SE_ or BE_ (SE means system exception and BE means Busniess exception).
Yes your right while running its getting error now You can see that in the screenshot it matches the both SE AND BE
or else
if you need single match use this expression in code
System.Text.RegularExpressions.Regex.Match(str,"\w+[_0-9]+")
if you need Multiple matches use this expression in code
System.Text.RegularExpressions.Regex.Matches(str,"\w+[_0-9]+")
@Karthik_Murugesan
your right
use this and let me know now
System.Text.RegularExpressions.Regex.Match(str,"\w+[_0-9]+").Value
@Karthik_Murugesan
1 Like
Hope its clarified for you
@Karthik_Murugesan
yes , now it’s resolved thanks.