Reply To: regexp to search a string

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf regexp to search a string Reply To: regexp to search a string

#58235
Steve Carter
Participant

    It should be as simple as adding a variable to the end of your regexp.

    $  set comment “this is an aop type comment”

    $  regexp {(tba|TBA|aop|AOP)} $comment output

    $  1

    $  puts $output

    $  aop

    This is assuming you don’t want the – / or blank space returned.  You may also want to drop the ^ and $ from your regexp unless the string will only contain one of the four values.

    Hope this helps.

    Steve