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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



Ram.bm
Novice

Jan 29, 2014, 4:47 AM

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

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


BillKSmith
Veteran

Jan 29, 2014, 9:51 AM

Post #2 of 3 (906 views)
Re: [Ram.bm] 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.


Code
$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,
Bill


Laurent_R
Veteran / Moderator

Jan 29, 2014, 11:03 AM

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


In Reply To

Code
$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