DX NetOps

  • 1.  Ignoring case in Match Regex

    Posted Jul 09, 2013 08:15 PM
    Is there a flag to ignore case when doing the Match or Do Not Match Regex. In particular when using regex to filter interfaces.

    For example if I want to ignore any interfaces that have "About" in the ifdesc, I want to ignore it if it is About, ABOUT, about, abouT, etc

    I am familiar with the method of doing ([aA][bB][oO][uU][tT)  however I have a lot of things to filter on and that can become very monotonuos.

    egrep offers an expression modifier -i which means ignore case.  This isn't part of expression, it is part of the command, so I can't use it for filtering interface.

    Is there a global option to ignore case for all regex entered in the IM Data Aggregator?


  • 2.  RE: Ignoring case in Match Regex

    Posted Jul 10, 2013 09:33 AM
    Hey Andrew,

    I had opened a support ticket a week or so ago asking about the Regex support, since I was getting back unexpected results. It turns out CAPC uses the mysql daemon to execute the regex. MySQL uses the POSIX regex implementation, whereas I was using PCRE regex syntax.

    POSIX Regex: http://en.wikipedia.org/wiki/Regular_expression#POSIX_extended
    MySQL Regex: http://dev.mysql.com/doc/refman/5.1/en/regexp.html

    MySQL regex is case-insensitive by its nature, so you should be getting back what you want by putting any iteration of "about" into the rule text field.

    Here's an example to show the case-insensitivity of mysql's regex engine:
    mysql> select 'about' REGEXP 'ABoUt';
    +------------------------+
    | 'about' REGEXP 'ABoUt' |
    +------------------------+
    |                      1 |
    +------------------------+
    1 row in set (0.00 sec)
    
    mysql> select 'ABOUT' REGEXP 'ABoUt';
    +------------------------+
    | 'ABOUT' REGEXP 'ABoUt' |
    +------------------------+
    |                      1 |
    +------------------------+
    1 row in set (0.00 sec)
    Lastly, I did try this myself where I created a rule to filter on "Interface Description" matching regex "a", and then I tried it a different time where I set it to match on "A". Both rules returned the same set of interfaces, as I would expect.


  • 3.  RE: Ignoring case in Match Regex

    Posted Jul 10, 2013 05:50 PM
    I'll give it another go.

    Yes the regex in CAPC seemed to be case insensitive however I am sure I was having problems with case in IM Data Aggregator Interface filtering. I'll test it again. I do have a support ticket in for interface filtering not always applying eg interaces still displaying as active even after they are filtered out.


  • 4.  RE: Ignoring case in Match Regex

    Posted Jul 10, 2013 07:28 PM
    Ah, sorry Andrew -- I thought you were referring to the rule criteria for populating Groups in the CAPC.


  • 5.  RE: Ignoring case in Match Regex

    Posted Jul 11, 2013 09:18 PM
    I'll get some info on what regex engine the DA so we can figure out if there is a way to ignore case with it.


  • 6.  RE: Ignoring case in Match Regex

    Posted Jul 11, 2013 09:50 PM
    Thanks that would be great as Regex isn't a single standard. As Justin has pointed out, different engine have implemented slightly differently.


  • 7.  RE: Ignoring case in Match Regex

    Posted Jul 11, 2013 09:57 PM
    Forgot to mention, I believe the DA is also ignoring case (what I want) for Interface filtering. I think the real issue, which is another topic, is the UI in the DA is not updating to reflect the current state of play. I'll start another thread as getting off topic