Forum OpenACS Development: Re: 'in' operator in if tag seems messed up.

Collapse
Posted by Tom Jackson on

How do you construct the regexp using the word anchors? the current code for in is:

    in { 
      set expr [join [lrange $args $i end] "|"]
      append condition "\[regexp \"$expr\" $arg1\] " 
      set next [llength $args]
    }

The 'inlist' addition uses the following:

    inlist { 
      set expr [lrange $args $i end]
      append condition "\[expr \[lsearch \"$expr\" $arg1\] + 1] " 
      set next [llength $args]
    }

inlist works even when you construct the list in tcl, will your regexp work in that situation? Should inlist be added for future use?

Collapse
Posted by Dan Wickstrom on
Sorry about that, I confused perl's re flavor with tcl's. For tcl you need to use \m and \M. Something like the following should work:

in { 
    set expr "\\m([join [lrange $args $i end] "|"]\\M"
    append condition "\[regexp \"$expr\" $arg1\] " 
    set next [llength $args]
}

Collapse
Posted by Dan Wickstrom on
There should have been a close parenthesis:

set expr "\\m([join [lrange $args $i end] "|"])\\M"