Reputation: 11
I am trying to create a Regex to get a value after 'New Serial Number'
Input String : [EXT] EOL Resolved : 343250; Serial Number : OLD123 ; New Serial Number : NEW123; UPS Tracking Number : UPSTRN123;
I need output to be 'NEW123'
Tried :
Match(%K00291;"(?<=New Serial Number :)(.*;)";true)
But I am getting output as : NEW123; UPS Tracking Number : UPSTRN123;
Upvotes: 0
Views: 47
Reputation: 186668
You should use .*?
(*?
- zero or more but as few as possible) instead of .*
(which ends up to the last ;
) in order to stop matching at the nearest ;
:
..."(?<=New Serial Number :)(.*?)(?=;)"...
Finally, if you don't want to include trailing ;
into match, let's put it as (?=;)
Upvotes: 1