in reply to REGEX question

Method calls do not expand in strings nor regexes. Store $input->param('wrapper') in a variable ahead of time.
my $w = $input->param('wrapper'); for (keys %input) { $report =~ s/\Q$w$_$w/$input->param($_)/eg; $report =~ s/\Q$w\L$_\E$w/$input->param(lc)/eg; $report =~ s/\Q$w\U$_\E$w/$input->param(uc)/eg; }
japhy learned something today -- \Q, \L, and \U nest with their respective \E as shown above.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: REGEX question
by S_Shrum (Pilgrim) on Feb 06, 2002 at 05:49 UTC

    Japhy! Good 2CU again (RIP perlguru.com)

    Thanx for the code...I figured I couldn't start off with the UC and LC (as these would have just been looked at as part of the string replace.

    I'll assume (for now) that this is good (all your other stuff has been). I am in the middle of debugging a ton of other stuff. but should get to this later 2nite.

    Cheers

    Sean Shrum
    sean@shrum.net

      Nix that last post from me...I had some stray test code in the script that was doing bad things.

      I tried the code you provided and nothing seems to be happening to the tokens on the template. No errors are being generated either ;-).

      Any other ideas???

      Thanx for all your help to date.

      ======================
      Sean Shrum
      http://www.shrum.net

Re: Re: REGEX question
by S_Shrum (Pilgrim) on Feb 14, 2002 at 10:48 UTC
    Okay...I'm finally at the point where I am seeing results. I tried the code above and the search is working but the replace is placing a reference like: 'CGI=HASH(0x1522d58)->param('someparam')' TIA

    ======================
    Sean Shrum
    http://www.shrum.net

      I have a feeling you're leaving out the /e modifier, then.

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who could use a job
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;