I am trying to pick out a range of IP addresses using REGEXP but
failing miserably :)
The pattern I want to match is:
10.%.224-239.%.%
The regex I have looks like this:
AND INET_NTOA(src_ip) REGEXP '\d{1,3}\\.\d{1,3}\.(22[4-9]|23[0-9])\\.\d{1,3}'
but, go fish. Thoughts?
Thanks!
--
Paul
Paul,
You could look for a tool called The Regex Coach. While it is mainly
for Windows, it runs very well in vine. I fijd it highly useful to debug
regexps.
Best regards,
Olivier
--
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
Trying to pattern match ip addresses is a famous anti-pattern; it's one of
those things like you feel like it should work, but it won't.
Your case, however, is pretty specific. taking advantage of the limited
range (I will assume you only wanted 4 sections of IPv4)
this should come close:
I don't think it accepts \d, or much of anything else I am used to
putting in expressions :)
This is what I ended up with and it appears to be working:
REGEXP '10.[[:alnum:]]{1,3}.(22[4-9]|23[0-9]).[[:alnum:]]{1,3}'
On Thu, Mar 19, 2015 at 11:10 AM, Michael Dykman mdyk...@gmail.com wrote: