You are viewing limited content. For full access, please sign in.

Question

Question

RegEx Help: Isolating Text

asked on October 7, 2024

Good Afternoon all,

I am trying to isolate the attached highlighted value in a token:

I have been getting pretty close, but I think the "()" is throwing off the expression that I have been trying. Does anyone have any ideas?

Thank you in advance.

0 0

Answer

SELECTED ANSWER
replied on October 8, 2024 Show version history

Try this to allow for possible whitespace characters as well as 0 or more characters between the ( and ).

Cash\s*Audit\s*Date\s*\([^\)]*\)\s*\r\n\s*(\d{2}/\d{2}/\d{4})

or

Cash\s*Audit\s*Date[^\r\n]*\r\n\s*(\d{2}/\d{2}/\d{4})

 

1 0

Replies

replied on October 7, 2024

Looks like you are trying to isolate the date. A couple of things you can depending on the data as I see some of it is blocked in your screenshot. 

You could use the following pattern to find the date and also use the index option in the Token editor to chose the line it is on, of course this assume the date always appears on that line number.


 

1 0
replied on October 7, 2024 Show version history

If there are multiple dates and you cannot use the line number to isolate the date then the following syntax should look for that previous text shown before the date in your value.

2 0
replied on October 7, 2024 Show version history

I feel like this may be the better approach. The first one would be nice and simple but this will be inconsistent. I just tried this second way and feel so close. When I tried with a Pattern Matching activity (opposed to the Pattern Match within the Token Dialog, I got this highlighted character this time, I am sure it is now effecting the expression of Cash Audit Date \(\)\r\n(\d{2}/\d{2}/\d{4})

Cash Audit Date (�) 

 

What minor edit will be required?

Thanks!

0 0
replied on October 8, 2024

Try  Cash Audit Date \([^\)]\)\r\n(\d{2}/\d{2}/\d{4}) to account for extra characters in between the parentheses. [^\)] is "anything but a closing parenthesis".

1 0
replied on October 8, 2024

Hey Miruna,
 

Cash Audit Date \([^\)]\)\r\n(\d{2}/\d{2}/\d{4}) gave me an empty match :/

0 0
SELECTED ANSWER
replied on October 8, 2024 Show version history

Try this to allow for possible whitespace characters as well as 0 or more characters between the ( and ).

Cash\s*Audit\s*Date\s*\([^\)]*\)\s*\r\n\s*(\d{2}/\d{2}/\d{4})

or

Cash\s*Audit\s*Date[^\r\n]*\r\n\s*(\d{2}/\d{2}/\d{4})

 

1 0
replied on October 8, 2024

Nice! Thanks Bert, this worked.
Thank you everyone who helped me through this:)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.