[Sciviews-commits] r37 - komodo/SciViews-K/content/js/tools

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 2 22:53:47 CEST 2008


Author: romain
Date: 2008-07-02 22:53:47 +0200 (Wed, 02 Jul 2008)
New Revision: 37

Modified:
   komodo/SciViews-K/content/js/tools/strings.js
Log:
added toRegex function

Modified: komodo/SciViews-K/content/js/tools/strings.js
===================================================================
--- komodo/SciViews-K/content/js/tools/strings.js	2008-07-02 20:53:23 UTC (rev 36)
+++ komodo/SciViews-K/content/js/tools/strings.js	2008-07-02 20:53:47 UTC (rev 37)
@@ -37,12 +37,12 @@
 // changes a string to a regular expression
 sv.tools.strings.toRegex = function(str){
 	// round brackets
-	str = str.replace( "(", "\\(" );
-	str = str.replace( ")", "\\)" );
+	str = str.replace( /\(/g, "\\(" );
+	str = str.replace( /\)/g, "\\)" );
 	
 	// square brackets
-	str = str.replace( "[", "\\[" );
-	str = str.replace( "]", "\\]" );
+	str = str.replace( /\[/g, "\\[" );
+	str = str.replace( /\]/g, "\\]" );
 	
 	// TODO: anything else
 	return( str ) ;



More information about the Sciviews-commits mailing list