11-26-2007, 08:53 PM
is there a way to assign the values of the back references to variables in one fell swoop?
eg
eg
findrx, back referencing, and variable assignment
|
11-26-2007, 08:53 PM
is there a way to assign the values of the back references to variables in one fell swoop?
eg
12-06-2007, 06:26 PM
But there are no bakreferences. Do you mean subpaterns? Anyway, a backreference match is exactly the same as the subpatern that it references.
str c; ARRAY(str) a If there are > 1 subpaterns, you need ARRAY. If 1, str.
12-07-2007, 01:06 PM
the array setup will work fine.
i guess im not understanding Friedl's section on backreferenceing. i thought the parenthetical phrases were the backreferencing and the "(\1)" was just a way to tell the code which backreference to, for example, pass to a variable. is that not correct?
12-07-2007, 01:52 PM
We can speak about back references only when using a \number. Phrases in () are called subpatern or capturing subpatern or subexpression.
Back references are particularly useful when removing html or similar tags: <tag ...>text</tag> <(\w+).*?>(.*?)</\1> |
« Next Oldest | Next Newest »
|