[Israel.pm] Regex question

Shmuel Fomberg semuelf at 012.net.il
Sat Jan 24 16:40:06 PST 2009


Hi All.

Is it correct that this regex:

$content =~ /^(
	[\$@%&*]
	(?: : (?!:) | # Allow single-colon non-magic vars
		(?: \w+ | \' (?!\d) \w+ | \:: \w+ )
		(?:
			# Allow both :: and ' in namespace separators
			(?: \' (?!\d) \w+ | \:: \w+ )
		)*
		(?: :: )? # Technically a compiler-magic hash, but keep 				  #it here
	)
)/x;

is the same is this?

$content =~ /^(
	[\$@%&*]
	(?: : (?!:) | # Allow single-colon non-magic vars
		(?: \w+ | \' (?!\d) \w+ | \:: \w+ )
	)
	# Allow both :: and ' in namespace separators
	(?: \' (?!\d) \w+ | \:: \w+ )*
	(?: :: )? # Technically a compiler-magic hash, but keep it here
)/x;

Thanks,
Shmuel.



More information about the Perl mailing list