Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (12.7k points)

I have made a process that reads PDFs and scraps their text in UiPath. I am struggling to come up with a regular expression that I can use to search for a PO Number. The text that comes from the scrap is fairly unstructured so my best bet is to search for a set of numbers that starts with a 'PO' with no space. For example, "PO1234567890". I will be setting a variable so the system knows that no PO number was found if the string doesn't come up with anything. Any reference material would be welcome as I am a beginner to VB. Thanks!

I have researched and cannot find a way to do the type of search I would like to do.

I expect to be able to search for a "PO1234567890" and no let something like "PO" save. So I somehow need to be able to search for "PO - two digits" and any numbers following without whitespace.

1 Answer

0 votes
by (29.5k points)

Just try the following and see if it works:

Dim Regex As System.Text.RegularExpressions.Regex

Regex = New System.Text.RegularExpressions.Regex("PO[0-9]+")
Regex.Matches(SearchString)


 

The regex string PO[0-9]+ means PO followed by at least one number
 

Browse Categories

...