Home
The Toolkit for Online Communities
15903 Community Members, 0 members online, 1858 visitors today
Log In Register

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

OpenACS Home : Forums : OpenACS Development : Re: 'in' operator in if tag seems messed up. : One Message

+
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?

+
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]
}

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

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