Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: substitute characters in the RHS of a search & replace

by LanX (Saint)
on Mar 08, 2013 at 23:57 UTC ( [id://1022507]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $x = q{Here are [[a variable]] number [[of words]] in brackets};
    say $x;
    $x =~ s{\[\[(.*?)\]\]}{ (my $x=$1) =~ s/ /_/g; $x }ge;
    say $x;
    
  2. or download this
    Here are [[a variable]] number [[of words]] in brackets
    Here are a_variable number of_words in brackets
    
  3. or download this
    sub blank2under {
      my $x=shift;
      $x =~ s/ /_/g;
      return $x;
    }
    
  4. or download this
    sub rx (&$) {
      my $c_regex=shift;
    ...
    print "$x\n";
    $x =~ s(\[\[(.*?)\]\])( rx {s/ /_/g} $1 )ge;
    print "$x\n";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1022507]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found