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

Question

Question

REGEX to pull all file numbers

asked on January 27

I am trying to pull all file numbers out of this text...  ACM-24-01000 (ACM/KHCTAC1), LIN-24-01000 (LIN/LINR34), CBN-01001-24    (CBN/CBNE11).

This is the expression I have...\w\w\w.\d{2,5}.\d{2,5}.(?![\]])

I don't need the info in the brackets or the space and comma before them. No matter what I try, it is not picking up the LIN-24-0010. 

Please help.

0 0

Answer

SELECTED ANSWER
replied on January 27
(\S+)(?:\s+\(\S+\))

https://regex101.com/r/AqXSeu/1

1 0
replied on January 28

This one worked! Thank you so much.

0 0

Replies

replied on January 27

Did you set it to return all matches as a multi-value token?

Your pattern works for me:

0 0
replied on January 27

Yes, I did. That's what is confusing me. 

Must be a glitch somewhere. We are scheduled to upgrade to 12 next week, so hopefully not longterm.

0 0
replied on January 27

Oh, that is weird. There must be some sort of unprintable characters in that string. Upgrade likely won't fix it.

If you want us to look into it further, please briefcase the doc and have your solution provider open a case with Tech Support.

0 0
replied on January 28

I noticed that Miruna has the option "Allow tokens in the pattern" unchecked while yours, Mary Lou, has it checked. Maybe uncheck that option to see if that fixes the issue?

0 0
replied on January 28

No difference unchecking the token box. Very observant though!

0 0
replied on January 28

"Allow tokens in the pattern" is only relevant if you have anything in the "%(name goes here)" format as part of the pattern. The checkbox signals to WF that you want it to attempt to resolve those tokens and substitute the values into the pattern before evaluating it against the input string.

If you don't have any tokens, which Mary Lou didn't, the state of the checkbox is irrelevant.

1 0
replied on January 28

Similar to what Miruna says, non-printable characters have caused issues for me in the past, simply as you can't see them! I've used a tool like this in the past which will tell you if there are line breaks/carriage returns etc in the input. I've come across all sorts of odd characters, particularly when handling data from a third party system. 

https://toolsaday.com/text-tools/text-to-ascii

A line feed equates to ASCII code 10 and a carriage return is 13 (https://www.alpharithms.com/ascii-table-512119/)

0 0
replied on January 28

Thank you . I will be sure to try this first next time.

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

Sign in to reply to this post.