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.