Forum Discussion

Jeff_47438's avatar
Jeff_47438
Icon for Altocumulus rankAltocumulus
Mar 06, 2018

Can scan do this regex?

The string variable TO_HEADER1 is " "

Since this ANI was dynamic, I was going to try this...

    "set ANI [regexp {([555])[^_]*\1} $TO_HEADER1 enclosed_string]"

Not sure if the regex works, but can scan do this?

  • you can use following command

    set enclosed_string [findstr $TO_HEADER1 "555" 0 "_"]
    

    0 is the character number skipped starting at the position of the first found character. 0 means "555" is included in the returned string.

    If you can't to skip 555, use following command:

    set enclosed_string [findstr $TO_HEADER1 "555" 3 "_"]