Detecting number ranges

Hello!

I’d like to check if a segment contains a number range with hyphen, like 1-230 or 50-3456
I wrote regex pattern

<[:digit:]+-[:digit:]+>

But it also picks up groups that are not number ranges like 555-678-345.
Isn’t the > interpreted as the word boundary?

Yes, the > is a word boundary, but the dash - is also considered a word delimiter so it matches the search.

Maybe you can try with PowerSearch with this search expression:

"<[:digit:]+-[:digit:]+>" -"<[:digit:]+-[:digit:]+-[:digit:]+>"

1 Like

Thank you, it works great!