Hi Wagner and Juan Pablo,

Thanks for the response! I also tried this:

var regObj:RegExp = new RegExp( "ˆ" + searchField_txt.text, "i" );
var filteredList:XMLList = landen.country. ( regObj.test( countryname.toLowerCase() ) );

And that worked aswell. However the sollution provided by both of you is the way it should.

Thanks!

Sidney


On Apr 22, 2008, at 3:35 PM, Wagner Amaral wrote:

If you pass a second parameter of "i" to the RegExp constructor, it will
match insensitively:

var regObj:RegExp = new RegExp( "ˆ" + searchField_txt.text, "i" );

Look here for the description of all the flags a RegExp can take in AS3:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/RegExp.html#RegExp()



On Tue, Apr 22, 2008 at 9:13 AM, Sidney de Koning <[EMAIL PROTECTED] >
wrote:

Hi List,

I'm filtering my loaded XML with RegEx (regular expressions). The input i filter on is in a textfield. So I have a textfield on the stage and match
that to the text in my XML.
Right now i have a pattern the allows me to search only lowercase, but since all the names in my xml start with a capital i have a problem. This is
my pattern:

var regObj:RegExp = new RegExp( "^.*[[:upper:]a-z].*"+
searchField_txt.text +".*" );

My xml consist of country names, Andorra, Angola, Anguilla, Cuba, Cyprus,
Denmark etc.

What I want to do is this; when i type: an it returns a list of Andorra, Angola, Anguilla. But when i type in an extra g, so now the word in my textfield becomes: "ang" it should return the list Angola, Anguilla. The pattern i have works a bit, but not quite. And my knowledge of RegEx is only exsisting since this morning. So what i want the RegEx to do is allow me to search the text, no matter if i type in lower-/uppercase and in the correct
order.

Is there a RegEx rockstar who can help me on this?

Thanks in advance,

Sidney de Koning
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to