Reputation: 568
I'm using Nintex Workflows and running into an issue trying to extract a alphanumeric value after the word number:
using RegEx Action. I have two entries in document that I'm parsing.
Today's serial is number: A12345
This line appears twice in the email and I only watch to capture the first instance. Note: The alphanumeric value changes with each email it's not static.
Currently I'm using (?<=number:\s) ([a-zA-Z0-9]+$)
however it doesn't match anything. When I do (?<=number:\s)\w+
it matches the results both times.
What do I need to the working example to only collect the first match?
Upvotes: 0
Views: 296
Reputation: 174786
You could try the below regex,
(?s)^.*?number:\s([a-zA-Z0-9]+)
And get the string you want from group index 1. In (?s)
dotall mode, ^
matches the start of first line only.
OR
You could use the below variable length look-behind based regex.
(?s)(?<=^.*?number:\s)[a-zA-Z0-9]+
Upvotes: 1