Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Regex AND NOT with zero-width negative lookahead assertion

by Veltro (Hermit)
on Mar 25, 2020 at 13:07 UTC ( [id://11114636]=note: print w/replies, xml ) Need Help??


in reply to Regex AND NOT with zero-width negative lookahead assertion

Haven't looked at hippo's answer yet but in the mean while I tried:

#!/usr/bin/perl use strict; use warnings; while( <DATA> ) { chomp ; print "$_ -> " ; if ( m/^\/(?:[^\/]|(?<=\\)\/)+\/$/ ) { print " matched\n" ; } else { print " not matched\n" ; } } __DATA__ /aaa/ /\a\a\a\/\b\b\b/ /aaa\/bbb/ /aaa/bbb/

Output

/aaa/ -> matched /\a\a\a\/\b\b\b/ -> matched /aaa\/bbb/ -> matched /aaa/bbb/ -> not matched

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found