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

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

by LanX (Sage)
on May 26, 2021 at 13:03 UTC ( #11133060=note: print w/replies, xml ) Need Help??


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

IF sequences are always consecutive and never interrupted, one could try to grab the first and the last of each sequence and replace each sequence in a loop.

BUT you need to be sure that neither

  • neither 43:1:1; 43:1:2; 43:1:5; 43:1:6;
  • nor 43:1:1; 43:1:2; 27:3:7; 43:1:3; 43:1:4;
happens.

Still I wouldn't choose to embed Perl into a regex to solve that.

That's only complicating things, because the complex logic would be only obfuscated

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://11133060]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2022-05-26 02:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (92 votes). Check out past polls.

    Notices?