Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Regexp substitution on variable-length ranges with embedded code?

by AnomalousMonk (Archbishop)
on May 26, 2021 at 13:27 UTC ( [id://11133062]=note: print w/replies, xml ) Need Help??


in reply to Regexp substitution on variable-length ranges with embedded code?

$seq =~ s/ (\d+):(\d+):(\d+) (?:;|\s)* (\1):(\2):(?{1+($3|$6)}) /$1:$2:$3-$6/xg;

FWIW, the (?{1+($3|$6)}) expression | embedded code expression in the quoted regex just adds 1 to the bitwise-or of $3 and $6 (treated as numbers... I think) and then throws away the result; it's a no-op.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-18 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found