Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by LanX (Saint)
on May 26, 2021 at 13:03 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-18 14:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found