Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Modifying muliple matched strings in text

by nysus (Parson)
on Jul 12, 2020 at 12:18 UTC ( [id://11119206]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    blah blah [click me](click me) more stuff
    blah [link here](link here) blah blah
    ...
    
  2. or download this
    blah blah [click me](/click-me) more stuff
    blah [link here](/link-here) blah blah
    ...
    
  3. or download this
    #!/usr/bin/env perl
    use strict;
    ...
    my $orig_part2 = $part2;
    $part2 =~ s/ /-/g;
    $text =~ s/\Q$part1$orig_part2\E/$part1$part2/g;
    
  4. or download this
    blah blah [click me](/click-me) more stuff
    blah [link here](/link here) blah blah
    
  5. or download this
    my $text = "blah blah [click me](click me) more stuff\nblah [link here
    +](link here) blah blah";
    $text =~ s/(\[[^]]+]\()/$1\//g; # make links absolute
    ...
      $part2 =~ s/ /-/g;
      $text =~ s/\Q$part1$orig_part2\E/$part1$part2/g;
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-03-29 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found