ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It would return B. Based on OP's criteria as stated, any hyphenated "word" would normally be returned as multiple words, but 52 does not contain a letter so would not be returned.
\b is from PCRE (perl). Not yet standard in ERE (grep -E, sed -E, awk, ...)
It exists in a recent Linux glibc, but not all tools use it.
The older \< \> is always supported in Linux.
Compare with \s - the older [[:blank:]] works with all tools in Linux.
No, \b is not "from" PCRE and it is not "PCRE (perl)" either.
PCRE is a C library started in 1997 that was originally inspired by Perl v5, but PCRE is not Perl, and nor is it where \b for word boundary came from.
I can't say for sure where \b originated from - other than definitely not from PCRE - Perl had \b in (at least) v4 in the early 90s (no idea about earlier versions), and the original v1 of Gawk released in the late 80s originally had \b for word boundary - with v3 it was switched to \y to allow compatibility with original AWK using \b for backspace.
Quote:
The older \< \> is always supported in Linux.
Gawk had \< and \> in v2, but not in v1 - thus they were probably added early 90s - and it seems Howard Helman added them to Sed in 1991 - so it's possible \< and \> are newer constructs - despite many "modern" regex implementations for some reason not implementing them.
No, \b is not "from" PCRE and it is not "PCRE (perl)" either.
PCRE is a C library started in 1997 that was originally inspired by Perl v5, but PCRE is not Perl, and nor is it where \b for word boundary came from.
I can't say for sure where \b originated from - other than definitely not from PCRE - Perl had \b in (at least) v4 in the early 90s (no idea about earlier versions), and the original v1 of Gawk released in the late 80s originally had \b for word boundary - with v3 it was switched to \y to allow compatibility with original AWK using \b for backspace.
Gawk had \< and \> in v2, but not in v1 - thus they were probably added early 90s - and it seems Howard Helman added them to Sed in 1991 - so it's possible \< and \> are newer constructs - despite many "modern" regex implementations for some reason not implementing them.
https://perldoc.perl.org/perlre
perl does not know \< and \>. But it has \A and \Z (which are not the same, just probably similar).
But it has \A and \Z (which are not the same, just probably similar).
They are not the same at all - they are equivalent to "^" and "$" when matching single lines, but for multiple lines "\A" and "\Z" only match once (for the first/last respectively). In the latter case, usually one wants lowercase "\z", which doesn't exclude a final newline.
Quote:
Originally Posted by MadeInGermany
I think perl4, being from the pre-Web era, is completely extinguished.
Except, despite being a rewrite, Perl 5 mostly maintained compatibility (aside from the issues at the link above).
Anyway, who still uses Perl 5? All the cool kids have moved to Perl 7...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.