New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fail to find a match with a regular expression #15158
Comments
From spz1st@gmail.comThis is a bug report for perl from spz1st@gmail.com, Should the regular expression "\bmr\.\b" and "\bmr.\b" match "mr." in the string % perl -e '$str = "a mr. cmrbcmr"; $str =~ s/\bmr.\b/MR/g; print $str, "\n";' % perl -v Copyright 1987-2013, Larry Wall Flags: Site configuration information for perl 5.18.2: Configured by Debian Project at Thu Mar 27 18:28:21 UTC 2014. Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Locally applied patches: @INC for perl 5.18.2: Environment for perl 5.18.2: |
From @jkeenanOn Sat Jan 30 12:50:29 2016, spz1st@gmail.com wrote:
You are asking a question about pattern matching, but you're confusing matters by providing examples using substitutions. Let's start by simply focusing on the pattern matching. See first attachment: 127436-match.pl Running this program gives this output: The reason why there is no pattern matched in the first two examples lies in the way '\b' is precisely defined in 'perldoc perlre'. ##### The '.' in the string is not a '\w'; it's a \W'. So what you have there is two consecutive '\W' characters -- not a '\w' followed by a '\W'. This can be seen more clearly in the second attached file: 127436-reduced.pl. This file produces: ##### NO No bug in Perl here. Thank you very much. -- |
From @jkeenan |
The RT System itself - Status changed from 'new' to 'open' |
@jkeenan - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#127436 (status was 'rejected')
Searchable as RT127436$
The text was updated successfully, but these errors were encountered: