If the search pattern is a variable, I think you must use a RegExp
constructor rather than the /.../ RegExp literal notation. In other
words, do
new RegExp(searchString.text, "i")
instead of
/searchString.text/i
- Gordon
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of alexander.marktl
Sent: Thursday, March 08, 2007 1:33 PM
To: [email protected]
Subject: [flexcoders] Regular Expression Problem
Hi there.
I'm trying to use regex for a search function. I want case-insensitive
search, so I'm using the regex: /ANYTEXT/i
This one does work, but I want to insert a searchString.text variable
instead of ANYTEXT.
"/searchString.text/i" doesn't work.
How can i do this?
Here's the code, if it helps:
<mx:TextInput id="searchString"/>
<mx:DataGrid
dataProvider="{externalXML.customer.(name1.match(/stich/i))}">
...