Get PO Box Address Regex

Regex:

((P\sO\sBox\s\d{3}\n)(.*?(?<=,\s[A-Z]{2}\s\d{5}[-]\d{4})))

PDF string:

blah blah
P O Box 111
Apples, CD 87956-8888
blah blah

Blah blah

Ui Path Matches returns Null and Regexr returns what is needed.

@Destiny_Malone

Please try this

cheers

Welcome @Destiny_Malone to the UiPath Community Forums :partying_face:

Take a look here at this Regex Pattern:
^P\s?O\s+Box\s+.*

It will also handle when there are no spaces between ‘P’ and ‘O’

image

Hopefully this helps you :blush:

Cheers

Steve

Hi,

Probably it’s linebreak matter. Can you try to add \r? to your pattern as the following?

((P\sO\sBox\s\d{3}\r?\n)(.*?(?<=,\s[A-Z]{2}\s\d{5}[-]\d{4})))

Regards,

1 Like

Hi @Destiny_Malone

Try the following regex expression:

(?<=[A-Z\s])\d+\n(.*)

Hope it helps!!
Regards,

This was the solution, thank you!

1 Like

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