changeset 16918:ab46b5c77669

Fix word boundary handling in regexp pattern (bug #38778) * libinterp/corefcn/regexp.cc (do_regexp_ptn_string_escapes): Expand both '\<' and '\>' sequences to '\b' for PCRE to handle correctly.
author Mike Miller <mtmiller@ieee.org>
date Sat, 20 Apr 2013 14:39:25 -0400
parents 4bbc4b703fe4
children 908b4956cbfd
files libinterp/corefcn/regexp.cc
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/regexp.cc	Sun Jul 07 19:41:32 2013 -0400
+++ b/libinterp/corefcn/regexp.cc	Sat Apr 20 14:39:25 2013 -0400
@@ -70,6 +70,13 @@
               retval[i] = '\b';
               break;
 
+            // Translate \< and \> to PCRE word boundary
+            case '<': // begin word boundary
+            case '>': // end word boundary
+              retval[i] = '\\';
+              retval[++i] = 'b';
+              break;
+
 #if 0
 // FIXME : To be complete, we need to handle \oN, \o{N}.
 //         The PCRE library already handles \N where N