Here are my test strings:
- Word word word; 123-125
- Word word (1000-1000)
- Word word word (1000-1000); 99-999
- Word word word word
What regular expression should I use to extract only those numbers (format: \d+-\d+) that are not within brackets (the ones in bold above)?
I've tried this:
(\d+-\d+)(?!\))
But it's matching:
- Word word word; 123-125
- Word word (1000-1000)
- Word word word (1000-1000); 99-999
- Word word word word
Note the last digit before the second bracket.
I was trying to drop any match that is followed by a bracket, but it's only dropping one digit rather than the whole match! What am I missing here?
Any help will be greatly appreciated.