1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Regex using ^

Discussion in 'Support' started by ron, Oct 12, 2017.

  1. ron

    ron

    Joined:
    Aug 19, 2008
    Messages:
    146
    Likes Received:
    0
    Trying to figure out why I'm not hitting INCLUDE below. If I remove the ^, it works. But I want to make sure the line starts with /TestLine. The Regex analyzer indicates a match.

    @echo off
    setlocal
    set xdata=/TestLine this is a test line
    iff %@regex[^/TestLine, %xdata] == 1 then
    echo INCLUDE -- %xdata
    else
    echo EXCLUDE -- %xdata
    endiff
    endlocal
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,091
    Likes Received:
    85
    Get rid of the whitespace, it is not ignored:

    iff %@regex[^/TestLine,%xdata] == 1 then
     
  3. ron

    ron

    Joined:
    Aug 19, 2008
    Messages:
    146
    Likes Received:
    0
    Habit. Got to remember and keep things tighter. Thanks!
     

Share This Page