Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Is there a way to allow consecutive zero-length matches without using pos()?

by ambrus (Abbot)
on Nov 03, 2017 at 16:24 UTC ( #1202710=note: print w/replies, xml ) Need Help??


in reply to Re: Is there a way to allow consecutive zero-length matches without using pos()?
in thread Is there a way to allow consecutive zero-length matches without using pos()?

For an example, please see my old node The story of a strange line of code: pos($_) = pos($_); where I deliberately want to do that. It happens because to make the code more readable, I'm not matching one big regex with a lot of alternation, but multiple regexes one after another, and more than one of those can match the empty string at the same position.

  • Comment on Re^2: Is there a way to allow consecutive zero-length matches without using pos()?

Replies are listed 'Best First'.
Re^3: Is there a way to allow consecutive zero-length matches without using pos()?
by hippo (Chancellor) on Nov 03, 2017 at 16:41 UTC

    Thanks for the context. Does rubasov's solution not answer this question? In what way does it fail to meet your criteria?

      That solution rewrites the multiple regular expressions to a single big regular expression. That works, but I didn't need it. I never had jsm's performance problem (presumably because I didn't use those perl versions for that very old code), so assigning pos worked just fine for me.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2020-09-23 12:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (131 votes). Check out past polls.

    Notices?