Closed alexcpsec closed 9 years ago
Gah that is problematic. This is why I keep meaning to work on https://github.com/sroberts/hubot-vtr-scripts/issues/3 to make sure there's a standard way to do these sorts of checks.
So it's not perfect, but this I believe would be an improvement:
searchText.match(/\b[1-2]\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\.[1-2]?\d{1,2}\b/im)
@sroberts Just stumpled upon this bug. I fixed it for myself locally, so just try this one:
\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
See it in action: http://regex101.com/r/gT6xF7/1
@beastcraft Thanks so much for the suggestion. We have a lot of ideas on how to fix regexs in VTR and this fits in really nicely.
That in fact is the regex I use in another project (likely from a similar source).
The regex is not greedy, so it usually stop on the first digit of the final octet as it parses.
The symptoms are easily reproducible, as below:
I will try to look into this in a couple of weeks.