|
|
| more useful options | |
| PerlMonks |
Driving the Engine right off the roadby Intrepid (Curate) |
| on Aug 22, 2025 at 13:51 UTC ( [id://11166082]=perlquestion: print w/replies, xml ) | Need Help?? |
|
Intrepid has asked for the wisdom of the Perl Monks concerning the following question: The Perl Regexp Engine of course. I have been working hard on working out how to formulate a regular expression with a negative lookbehind and I cannot get it right. What I have right now is this: /^(?<!XDG_) [_A-Z0-9]+ _PATH$/x I'll explain in english what I need. There will be desired matches with strings like PKG_CONFIG_PATH but I must not match XDG_SEAT_PATH or XDG_SESSION_PATH. Naturally, it is not as simple as avoiding any match with a string beginning with XDG_ because I want to match XDG_DATA_DIRS, for example. (Yes, these are well-recognized environment variables). This works for getting only PATH: /^(?<!XDG_)PATH$/, so I can see that the Engine does understand the lookbehind. Any suggestions will be appreciated! Aug 22, 2025 at 13:49 UTCA just machine to make big decisions
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||