How about this?
import RegExp;
var a:String = "äur*?ß123.png";
var goodname:RegExp = new RegExp ("[^a-z0-9\\.]", "gi");
var return_str:String = a.replace(goodname, "_");
var output_txt:TextField = new TextField ();
output_txt.text = return_str;
addChild (output_txt)
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Flashcoders
mailing list
Sent: Tuesday, February 14, 2006 00:14
To: [email protected]
Subject: Re: [Flashcoders] regex needed
Importance: Low
David Rorex schrieb:
> On 2/13/06, Michael Stuhr <[EMAIL PROTECTED]> wrote:
>
>> i'm trying to use Joey Leott's (Pavils Jurjans') RegExp for replacing
>> BAD-strings in (to-be-uploaded) Filenames but had no success at all. can
>> anyone
>> give me some hints ?
>>
>> i have:
>>
>> <code>
>> import RegExp;
>>
>> var a:String = 'äur*?ß.png';
>> var goodname:RegExp = new RegExp ('/[^a-z0-9_\\-\\.]/i', 'g', 'i');
>> str.text = a.replace(goodname, '_');
>> </code>
>>
>> but the compiler says type mismatch in line 6 ....
>>
>>
>>
> Can you tell us which line is line 6? You only gave 5 lines of code...
>
>
count them. the compiler counts them too :-)
> also:
> 'a' is a string, and you are calling 'a.replace()'. Is that correct? (I
> don't know how the regexp library works exactly, so it may be)
>
it should be. RegExp adds some functions to String() by prototype, sth.
like String().replace().
it works (or should work) simpilar like preg_replace() in php.
any ideas ?
micha
micha
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com