I have a text line matching this pattern d{2}s?[a-zA-Z]s?d{2,5}
zero to many times.
I need to remove everything but the matching sequence in pure regex substitution (not using java loops etc)
Examples:
“foo 12a123” –> “12a123
“
“12a123 bar” –> “12a123
“
“foo 12a123 bar 32A1234 baz” –> “12a123
32A1234
“
“12 a123 bar 32A 1234” –> “12 a123
32A 1234
“
“foo bar” (no match) –> “”
Any ideas?