Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: about word boundary in RE (use re 'debug')

by Anonymous Monk
on Apr 02, 2013 at 08:21 UTC ( [id://1026617]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -Mre=debug -le " q/a a/ =~ /(.\b)\1/ "
    Compiling REx "(.\b)\1"
    ...
                                      failed...
    Match failed
    Freeing REx: "(.\b)\1"
    
  2. or download this
    $ perl -Mre=debug -le " q/aa/ =~ /a\b/ "
    Compiling REx "a\b"
    Final program:
    ...
       2 <aa> <>                 |  4:END(0)
    Match successful!
    Freeing REx: "a\b"
    
  3. or download this
         $x = "Housecat catenates house and cat";
        $x =~ /\bcat/; # matches cat in 'catenates'
        $x =~ /cat\b/; # matches cat in 'housecat'
        $x =~ /\bcat\b/; # matches 'cat' at end of string
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-29 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found