Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Unanswered: regexp to match IP

    unhappy results!
    please help
    tried with and without the escape \

    expected to match exactly the specified IP any where in the field

    mysql> select d07 from service where d07 regexp '10\.100\.1\.1';
    +------------------------------------------------+
    | d07 |
    +------------------------------------------------+
    | 10.100.101.186 on at 2011-06-20 02:12:02 |
    | 10.100.101.188 at 2009-05-12 05:12:47 |
    | 10.100.101.251 at 2009-03-26 16:00:37 |
    | 10.100.101.182 at 10282300 |
    | 10.100.101.70 on at 2011-04-25 02:16:27 |
    | 10.100.101.59 off since 2012-02-18 18:52:04 |
    | 10.100.101.229 on at 2011-10-17 22:40:56 |
    | 10.100.101.107 at 2009-12-01 06:09:32 |
    | 10.100.101.77 at 2009-05-31 05:10:32 |
    | 10.100.101.92 |
    | 10.100.101.91 off at 2010-08-07 10:07:57 |

    . . . and so on forever!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd try using:
    Code:
    select d07 from service where 1 = (d07 regexp '.*10\.100\.1\.1.*');
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jan 2013
    Posts
    2
    thanks - your expresion changes nothing - truth is truth = 1

    here is the behavior I expected:
    mysql> select d07 from service where d07 regexp '10.100.101.95';
    +-----------------------------------------+
    | d07 |
    +-----------------------------------------+
    | 10.100.101.95 on at 2011-05-24 02:08:49 |
    | 10.100.101.95 on at 2010-04-24 15:00:04 |
    +-----------------------------------------+
    2 rows in set (0.05 sec)

    could it be that there is something magic about 10.100.1.1?

    I have tried:
    select * from table where field regexp '^10.100.1.1'
    select * from table where field regexp '10\.100\.1\.1'
    select * from table where field regexp '10\.100\.1\.1[[:>:]]'
    select * from table where field regexp '[[:<:]]10\.100\.1\.1[[:>:]]'
    all same results

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •