Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^5: s///g within m//g regions (updated)

by LanX (Saint)
on Nov 09, 2021 at 14:11 UTC ( [id://11138618]=note: print w/replies, xml ) Need Help??


in reply to Re^4: s///g within m//g regions
in thread s///g within m//g regions

that's very different because there are no lines in between.

use strict; use warnings; use Test::More; my $in = 'A |simple*example| is |so*simple| to come*up |with these*days| according to some *experts*'; my $exp = 'A |simple-example| is |so-simple| to come*up |with these-days| according to some *experts*'; my $start = qr/\|/; my $stop = qr/\|/; my $got = $in; $got =~ s[ ($start) (.*?) ($stop) ][ "$1" . ( $2 =~ tr/\*/-/r ) . "$3" ]gsxe; is($got,$exp); done_testing;

updates
added
  • test
  • line-break

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found