I'm using a slightly modified code from perlre to extract the parameters to a method call in VB, that is , to match the contents of properly nested braces, skipping the braces found in VB-style string constants and I found something strange. It seems I cannot use my, for the $braces variable. Try the following code with and without the "my":
I getmy $braces = qr{ \( (?: (?> [^\(\)"]+ ) # Non-parens without backtracking | (?> "[^"]*")+ # skip string constants | (??{ $braces }) # Group with matching parens )* \) }x; my $Braces = qr{\(((?:[^\(\)"]+|"[^"]*")*(?:$braces(?:[^\(\)"]+|"[^"]* +")*)*)\)}; my $str = 'foo( FieldName, trim(CStr(Request.Form(FieldName))), Countr +yId )'; $str =~ $Braces and print "YES: $1\n" or print "NO!\n";
with the "my" andYES: CStr(Request.Form(FieldName))
without "my" withYES: FieldName, trim(CStr(Request.Form(FieldName))), CountryId
running under Win2k Server SP4This is perl, v5.8.0 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2002, Larry Wall Binary build 805 provided by ActiveState Corp. http://www.ActiveState. +com Built 18:08:02 Feb 4 2003
Is this a known bug, my misunderstanding, something that did not bite anyone yet, ...?
Thanks, Jenda
|
We'd like to help you learn to help yourself Look around you, all you see are sympathetic eyes Stroll around the grounds until you feel at home -- P. Simon in Mrs. Robinson |
In reply to (??{...}) in regexps and lexicals by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |