Regex Question
Peter Scott
Peter at PSDT.com
Wed Jul 17 12:24:23 CDT 2002
At 09:35 AM 7/17/02 -0700, abez wrote:
>I'm having problems making a regex which does this
>
>finds all
>
>$varname
>${varname}
>but doesn't find
>$varname{
>
> my @all = ($k =~ /(\$[a-zA-Z_0-9]+)/g);
> my @all2 = ($k =~ m#(\$\{[a-zA-Z_0-9]+\})#g);
>
>I've tried ($k =~ /(\$[a-zA-Z_0-9]+)(?!\{)/g);
>but that doesn't work..
$ cat foo
#!/usr/bin/perl -l
use strict;
use warnings;
$_ = '$one ${two} $three{four}';
s/ ( \$ (\{)? \w+ \b (?(2) \} ) (?! \{ ) ) /\$XXX/gx;
print;
$ ./foo
$XXX $XXX $three{four}
>Basically my goal is to take a perl script and replace all variable name
>with randomized names so that the source code is an utter pain to deal
>with but it still works.
Filter::decrypt, Acme::Buffy, Acme::Bleach, Acme::Morse, ...
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
More information about the Victoria-pm
mailing list