Visokio website     Downloads     Video tutorials     KnowledgeBase  
Regex funnies - Visokio Forums
Regex funnies
  • Guy_Cuthbert        Guy_Cuthbert August 20, 2010 5:15PM
    I'm certain Steve has advised me of this previously... but I can't remember. I'm trying to use SearchRegEx to locate certain string patterns, and the RegEx I would normally use is:

    [ABC]{1}\d{1}

    (I'm tracking paper sizes in a description field). Omniscope doesn't like:

    searchregex("[ABC]{1}\d{1}",[Description])

    complaining that this is invalid text... I think it's something to do with the square brackets?
    Atheon Analytics Ltd
    w: www.atheonanalytics.com
    e: guy.cuthbert@atheon.co.uk
    t: +44 8444 145501
    m: +44 7973 550528
    s: guycuthbert
  • 3 Comments
  • Guy_Cuthbert        Guy_Cuthbert August 20, 2010 5:21PM
    Found it :) The problem isn't the square bracket - it's the backslash (\) which Omniscope expects to be the start of a comment...

    ... the solution is to use a double backslash, so for my example above it's:

    searchregex("[ABC]{1}\\d{1}",[Description])
    Atheon Analytics Ltd
    w: www.atheonanalytics.com
    e: guy.cuthbert@atheon.co.uk
    t: +44 8444 145501
    m: +44 7973 550528
    s: guycuthbert
  •     steve August 21, 2010 11:37AM
    Yes, all backslashes must be doubled-up in formulas, because a backslash is the escape character, used before quotes and square brackets to insert literal quote/bracket characters into formulas. This is not the case for regex search in the query devices.
  •     steve November 9, 2011 4:59AM
    Update: you can use back-quotes `` in formulae instead of single or double quotes to avoid the need to escape with a backslash. See here:
    http://forums.visokio.com/discussion/comment/3436/#Comment_3436

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership