 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri May 09, 2008 8:54 pm
[2.25] %pat is officially broken in %subregex |
Even the example from the documentation doesn't work, so I don't feel so bad now that I can't make my slightly more complicated call work. The %subregex just returns empty/null strings for any %pat now.
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri May 09, 2008 8:58 pm |
Yep, subregex was rewritten, and I haven't gotten the full documentation writen for it yet.
You can see my post "Initial subregex documentation" for all of the new features, and also should check the comments for subregex that I wrote for 2.20.
I am aiming at having a good help document done this weekend. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed May 21, 2008 7:54 pm |
Yes, and to summarize the solution for others, you need to use \1 .. \99 to refer to subpatterns in the substitution string, just like with normal regular expression substitutions. The %pat function won't work in a substitution string anymore.
Also, using \1..\99 instead of %pat is faster. If your substitution string contains @ or % characters, then CMUD will try to compile it and execute it to expand variables or functions. Using \1..\99 performs the substring substitution internally within the regex routines without calling the CMUD parser, so it is much faster.
The reason %pat doesn't work is that it normally fetches subpatterns from the internal CMUD execution stack, and that execution stack is not being used by the PCRE subregex routine. |
|
|
 |
|
|