CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
differnce between \b

Jan 29, 2014, 4:47 AM

Post #1 of 3 (1983 views)
differnce between \b Can't Post

what is the difference between \b,\b+,(\b+) and [\b+]? Please let me know


Jan 29, 2014, 9:51 AM

Post #2 of 3 (1969 views)
Re: [] differnce between \b [In reply to] Can't Post

It depends on where you use them. The valid places are single quoted strings, double quoted strings, or regular expressions.

$string = qq/pattern\b/; # backspace character 
$string = q/pattern\b/; # backslash followed by letter b
$regex = qr/pattern\b/; # match a word boundary

$string = qq/pattern\b+/; # backspace and a +
$string = q/pattern\b+/; # backslash, b, and +.
$regex = qr/pattern\b+/; # Not sure.Unsure

Parentheses do not change the meaning of the \b.

Brackets do not change the meaning of the \b in a string.

Brackets in a regex define a character class.
Characters within the class have the same meaning as in double quoted strings.

Good Luck,

Veteran / Moderator

Jan 29, 2014, 11:03 AM

Post #3 of 3 (1965 views)
Re: [BillKSmith] differnce between \b [In reply to] Can't Post

In Reply To

$regex  = qr/pattern\b+/; # Not sure.Unsure 

AFAIK, in a regex, \b stands for a word boundary. I am not sure whether having two or more succeeding word boundaries make real sense.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives