summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclUtil.c7
-rw-r--r--tests/regexp.test27
-rw-r--r--tests/regexpComp.test39
4 files changed, 73 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index da29d56..e753ae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/regexp.test, tests/regexpComp.test: correct re2glob ***=
+ * generic/tclUtil.c (TclReToGlob): translation from exact
+ to anywhere-in-string match. [Bug 2065115]
+
2008-08-21 Don Porter <dgp@users.sourceforge.net>
* generic/tcl.h: Reduced the use of CONST86 and eliminated
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index a1a0861..5f20af1 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.99 2008/08/17 14:15:26 msofer Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.100 2008/08/21 23:19:49 hobbs Exp $
*/
#include "tclInt.h"
@@ -3279,10 +3279,9 @@ TclReToGlob(
*/
if ((reStrLen >= 4) && (memcmp("***=", reStr, 4) == 0)) {
- if (exactPtr) {
- *exactPtr = 1;
- }
+ Tcl_DStringAppend(dsPtr, "*", 1);
Tcl_DStringAppend(dsPtr, reStr + 4, reStrLen - 4);
+ Tcl_DStringAppend(dsPtr, "*", 1);
return TCL_OK;
}
diff --git a/tests/regexp.test b/tests/regexp.test
index 5b0f886..c4b4cab 100644
--- a/tests/regexp.test
+++ b/tests/regexp.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: regexp.test,v 1.32 2008/07/21 22:22:28 nijtmans Exp $
+# RCS: @(#) $Id: regexp.test,v 1.33 2008/08/21 23:19:51 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -44,6 +44,31 @@ test regexp-1.7 {regexp utf compliance} {
list [string compare $foo $bar] [regexp 4 $bar]
} {0 0}
+test regexp-1.8 {regexp ***= metasyntax} {
+ regexp -- "***=o" "aeiou"
+} 1
+test regexp-1.9 {regexp ***= metasyntax} {
+ set string "aeiou"
+ regexp -- "***=o" $string
+} 1
+test regexp-1.10 {regexp ***= metasyntax} {
+ set string "aeiou"
+ set re "***=o"
+ regexp -- $re $string
+} 1
+test regexp-1.11 {regexp ***= metasyntax} {
+ regexp -- "***=y" "aeiou"
+} 0
+test regexp-1.12 {regexp ***= metasyntax} {
+ set string "aeiou"
+ regexp -- "***=y" $string
+} 0
+test regexp-1.13 {regexp ***= metasyntax} {
+ set string "aeiou"
+ set re "***=y"
+ regexp -- $re $string
+} 0
+
test regexp-2.1 {getting substrings back from regexp} {
set foo {}
list [regexp ab*c abbbbc foo] $foo
diff --git a/tests/regexpComp.test b/tests/regexpComp.test
index 7feaa5f..eeba434 100644
--- a/tests/regexpComp.test
+++ b/tests/regexpComp.test
@@ -43,7 +43,7 @@ test regexpComp-1.2 {basic regexp operation} {
}
} 1
test regexpComp-1.3 {basic regexp operation} {
- evalInProc {
+ evalInProc {
regexp ab*c ab
}
} 0
@@ -69,6 +69,43 @@ test regexpComp-1.7 {regexp utf compliance} {
}
} {0 0}
+test regexp-1.8 {regexp ***= metasyntax} {
+ evalInProc {
+ regexp -- "***=o" "aeiou"
+ }
+} 1
+test regexp-1.9 {regexp ***= metasyntax} {
+ evalInProc {
+ set string "aeiou"
+ regexp -- "***=o" $string
+ }
+} 1
+test regexp-1.10 {regexp ***= metasyntax} {
+ evalInProc {
+ set string "aeiou"
+ set re "***=o"
+ regexp -- $re $string
+ }
+} 1
+test regexp-1.11 {regexp ***= metasyntax} {
+ evalInProc {
+ regexp -- "***=y" "aeiou"
+ }
+} 0
+test regexp-1.12 {regexp ***= metasyntax} {
+ evalInProc {
+ set string "aeiou"
+ regexp -- "***=y" $string
+ }
+} 0
+test regexp-1.13 {regexp ***= metasyntax} {
+ evalInProc {
+ set string "aeiou"
+ set re "***=y"
+ regexp -- $re $string
+ }
+} 0
+
test regexpComp-2.1 {getting substrings back from regexp} {
evalInProc {
set foo {}