Forum OpenACS Development: Re: Improving Gatekeeper Package

Collapse
Posted by Andrew Piskorski on
Yes certainly, the "\[ \n\t\]" is a character class matching either a space, a newline, or a tab.

Now a days that big long regexp pattern all in double quotes is somewhat poor style. (When originally written with an older version of Tcl, it might have been necessary to include the special \n and \t esacpes within double quotes so they would be interpreted by Tcl parser before being seen by the regexp command.)

With all recent versions of Tcl, you can remove a lot of the spurious backslashes by doing it in a few steps like this (note I haven't actually tested this pattern):

set pattern {(<[^>]*[ \n\t]+}
append pattern $tag
append pattern {[ \n\t]*=[ \n\t]*"?)\.\./([^> \n\t]*)([> \n\t])}
regsub -nocase -all $pattern page
The [ \n\t] business could also be replaced by a more general white-space character class as well.