Forum OpenACS Q&A: Re: Tcl Advanced Regular Expresions (ARE).
1a) The -lineanchor flag changes the behavior of the anchors ^ and $ making them match the beginning and end of a line (as opposed to the beginning and end of the entire string being matched).
1b) The -linestop flag changes the behavior of [^] (negative bracket expressions) and . (which matches anything) so that they will not match a newline on their own.
2) If you do [regexp -all $RE $input] the return value will be the number of matches.
First thanks for your fast response!
The problem is that I don`t understand at all the utility of those flags just by explanation of the man page (for example: how are processed the different lines of the input?) . If for example you have the following string:
set str "tcl bla 12 aab\n tk bra 34 rt\n tck bka 12\n"
Could you give me an example of the use of -lineanchor and -linestop when the regexp's input is str?.
I have put a bad example (counting the amount of matches), the question is: if you need to parse an input with several lines and extract for each line an string that matches a given pattern (that is, a loop that processes line by line, and of each line it extracts certain pattern and stores it). How obtain you that with regexp?.