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

Re^4: Regex Tool

by Yunus (Novice)
on Jul 03, 2006 at 01:41 UTC ( [id://558915]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Regex Tool
in thread Regex Tool

Uncheck the 'Begin of word' 'End of word' (last column). This is the option for word boundry. While the string boundry /line boundry set using the anchor option..

Replies are listed 'Best First'.
Re^5: Regex Tool
by eric256 (Parson) on Jul 03, 2006 at 16:45 UTC

    Okay I might not have been clear. Why, in with any option checked, is it adding \<. Is that a regex command that I just don't know? The only time i've seen \< in a reged it meant a literal < not something special.


    ___________
    Eric Hodges
      Previous \<, \>, \b indicates boundry. \< is beginning of word, \> is end of word. \b indicates either boundry.
      if u just put '<' in regex, it means character '<', nothing special.

      e.g. /\<hell/ will only match such string/word like 'hello', 'hell' but not 'shell'

      however, i seldom use word anchor. (but maybe someone else does) <\em>

      I hold this statement for a while. No argument on this. I suspend these anchors ( \< , \> ) and just use \b instead. I'll be more careful next time. Sorry everyone. This information actually referred to unreliable / wrong sources. Thanks for all feedbacks.

        Did you test your claim at all?

        use strict; use warnings; while (<DATA>) { chomp; my $matched = /\<hell/ ? 'yes' : 'no'; print "/\\<hell/ matches '$_'? $matched\n" } __DATA__ shell hell this is hell this is hellish this is <hell this is <hellish some shells are bad

        When run, this prints

        Q:\>perl -w tmp.pl 'shell' matches? no 'hell' matches? no 'this is hell' matches? no 'this is hellish' matches? no 'this is <hell' matches? yes 'this is <hellish' matches? yes 'some shells are bad' matches? no

        Please read perlre before making such claims.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-03-19 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found