This is probably a very easy question for those who know regular expressions.
What is the regular expression to extract a substring that consists of 4 digits, then a hyphen, and then 5 more digits?
For example, in this string
I would like to extract 1234-66677 from this string
I want to get the “1234-66677” part.
It’s always the same structure: 4 digits, hyphen, 5 digits.
Use this
\bare word boundaries, if you don’t use them it will also match on longer digits like e.g. “123456-123456789”See it here online on Regexr