great, thanks a lot! i found a tutorial about regex wwhich mentioned the use of flags but did not put any example so i couldn't make it work, now thanks to you i can :)
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Stith Sent: jeudi 8 mars 2007 1:03 To: jQuery Discussion. Subject: Re: [jQuery] regular expressions Quick tut: Just typing something out, eg, /abcd/ would replace anything that contained the exact string "abcd", case sensative. If you do /[abcd]/, notice the brackets, it will select the letter "a", the letter "b", etc. For ranges you can do something like /[a-d]/, which would do the same as /[abcd]/. Remember that regex is case sensative, unless you add an "i" flag to the expression, like /[a-d]/i , which would find "a-d", and "A-D". Also, it will only replace the first instance, unless you add a "g" flag, so: "once upon a time".replace(/o/,'O'); would make "Once upon a time", but: "once upon a time".replace(/o/g,"O"); would make "Once upOn a time" On 3/7/07, Ⓙⓐⓚⓔ <HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]> wrote: 1 command , 2 replaces var newString = oldString.replace(/X/,"-").replace(/Y/,"") On 3/7/07, Alexandre Plennevaux <HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] > wrote: > > > hello! > > I'm experimenting with regular expressions, and i would like to replace in a > string some special characters by a "-" minus sign, and others by just > removing it. > Do i need ot make two regex.replace(), or is it possible to have both in one > command? > > thank you very much for your time! > > Alexandre > > > > > > -- > Ce message Envoi est certifié sans virus connu. > Analyse effectuée par AVG. > Version: 7.5.447 / Base de données virus: 268.18.7/712 - Date: 6/03/2007 > 15:42 > > _______________________________________________ > jQuery mailing list > HYPERLINK "mailto:discuss@jquery.com"discuss@jquery.com > HYPERLINK "http://jquery.com/discuss/"http://jquery.com/discuss/ > > -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ _______________________________________________ jQuery mailing list HYPERLINK "mailto:discuss@jquery.com"discuss@jquery.com HYPERLINK "http://jquery.com/discuss/"http://jquery.com/discuss/ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.447 / Base de données virus: 268.18.7/713 - Date: 7/03/2007 9:24
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/