Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: How to enforce match priority irrespective of string position

by Polyglot (Friar)
on Mar 08, 2021 at 02:37 UTC ( #11129309=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to enforce match priority irrespective of string position
in thread How to enforce match priority irrespective of string position

I appreciate knowing that, but while the assertion may be "zero-width," my mind still stumbles on the point that "Point" is certainly not zero-width. I'd always understood the "zero-width" aspect to be more related to the capturing and positioning of the match within the string. Are all look-arounds zero-width? If so, why must a look-behind be always of a specified length (width) that is not variable?

Well, it may be that it's just too abstract for me.

Thank you for your explanation.

Blessings,

~Polyglot~

  • Comment on Re^4: How to enforce match priority irrespective of string position

Replies are listed 'Best First'.
Re^5: How to enforce match priority irrespective of string position
by eyepopslikeamosquito (Bishop) on Mar 08, 2021 at 03:30 UTC

    This reference explains it quite well:

    lookaround actually matches characters, but then gives up the match, returning only the result: match or no match. That is why they are called “assertions”. They do not consume characters in the string, but only assert whether a match is possible or not.

    ... most regex flavors do not allow you to use just any regex inside a lookbehind, because they cannot apply a regular expression backwards. The regular expression engine needs to be able to figure out how many characters to step back before checking the lookbehind.

    Hope that helps.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-09-19 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?