in reply to Regex Question
When dealing with regular expressions, my approach is to do the simplest thing that works.
In your case, this means looking for three capital letters, following by some stuff, and then a two or three digit number, a dash, and the same two or three digit number.
So the regexp I'd use would be
This makes the assumption that the two numbers at the end are the same. If they might be different, you'd have to change the second capture to something like/([A-Z]{3}).+(\d{2,3})-\2/
When in doubt, try the simplest thing that could work. You're putting 'Protocol' and other stuff in there -- throw it away -- you don't need it. :)/([A-Z]{3}).+(\d{2,3}-\d{2,3})/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex Question
by clegane (Novice) on Sep 10, 2013 at 18:32 UTC | |
|
Re^2: Regex Question
by Anonymous Monk on Sep 10, 2013 at 18:30 UTC |