Regex Error in Text File

Hello Team,
I have a text - “Rev 09/14 PRODUCER BULK MILK MANIFEST SELECT MILK PRODUCTS, INC. GRADE “A” RAW MILK MANIFEST# C1400881 PICK is DATE: 12 /27 /19 TIME: 16:00 ILL TIMES ARE
----------------------------------------”,
im applying regex " MANIFEST#\W\w\d+",
When trying to display in message box,it is giving me
image ,
Expected O/p is “MANIFEST# C1400881”,
Please guide

1 Like

regexOutputVariable(0)
use like this
if you have more than one matches
you can use For Each Loop and set Argument type to Object and Pass regexOutPutVariable
inside loop Print like Item.ToString

1 Like

Hello @Mayyur

Show the code that you are currently using to get this output : -

Also,Use Match to directly get the value into string as you just have to extract a single match…

Try this code

System.Text.RegularExpressions.Regex.Match(strrrr,"MANIFEST#\W\w\d+").ToString

Awesome
you were almost done
if the input is stored in a string variable named strinput
then use this expression in MESSAGE BOX activity
System.Text.RegularExpressions.Regex.Match(strinput.ToString,“MANIFEST#\W\w\d+”).ToString.Trim

the reason why this error occurred is if MATCHES activity or MATCHES in Regex expression if used we need to mention index position to get the value at specific position
because matches will give us value as a collections while MATCH method will give us as a object, a string

Cheers @Mayyur

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