Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by AnomalousMonk (Bishop)
on May 26, 2021 at 13:27 UTC ( #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? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-05-27 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (94 votes). Check out past polls.

    Notices?