Web lists-archives.com

Re: Help with REGEXP




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 <mdykman@xxxxxxxxx> wrote:
> 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:
>
> 10[.]\d{1,3}[.](224|225|226|227|228|229|23\d))[.]\d{1.3}
>
> On Thu, Mar 19, 2015 at 9:39 AM, Paul Halliday <paul.halliday@xxxxxxxxx>
> wrote:
>
>> 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 Halliday
>> http://www.pintumbler.org/
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:    http://lists.mysql.com/mysql
>>
>>
>
>
> --
>  - michael dykman
>  - mdykman@xxxxxxxxx
>
>  May the Source be with you.



-- 
Paul Halliday
http://www.pintumbler.org/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql