HighDots Forums  

Regular expression da correggere.

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss Regular expression da correggere. in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fabio Vent
 
Posts: n/a

Default Regular expression da correggere. - 09-15-2003 , 03:17 AM






Ciao a tutti,
io utilizzo una regular expression che mi controlla in un campo numerico
la presenza della seguente stringa ",00" e la sostituisce con vuoto, io
perņ vorrei sotituirela virgola e tutti gli 0 dopo di essa.

campo = window.document.forms[0].chlimite.value
rExp = /,00$/g;
newString = new String ("")
result = campo.replace(rExp, newString)
alert (result);

Avete qualche idea???
Grazie

F.


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

Reply With Quote
  #2  
Old   
Carlo Pellegrini
 
Posts: n/a

Default Re: Regular expression da correggere. - 09-15-2003 , 04:46 AM






"Fabio Vent" <fabvenie (AT) tin (DOT) it> ha scritto nel messaggio
news:68c93cfe684d571057ea433ac7e22f38.109646 (AT) mygate (DOT) mailgate.org...
Quote:
Ciao a tutti,
io utilizzo una regular expression che mi controlla in un
campo numerico
la presenza della seguente stringa ",00" e la sostituisce
con vuoto, io
perņ vorrei sotituirela virgola e tutti gli 0 dopo di
essa.

campo = window.document.forms[0].chlimite.value
rExp = /,00$/g;
rExp=/,(0*)$/g

Quote:
newString = new String ("")
result = campo.replace(rExp, newString)
alert (result);

Avete qualche idea???
Grazie

F.


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG



Reply With Quote
  #3  
Old   
Fabio Vent
 
Posts: n/a

Default Re: Regular expression da correggere. - 09-15-2003 , 05:02 AM



"Carlo Pellegrini" <##NOSPAMPLEASE##carlo.pe##NOSPAM##llegrini (AT) libero (DOT) >
wrote in message news:bk3u56$ok958$1 (AT) ID-104614 (DOT) news.uni-berlin.de


Quote:
rExp=/,(0*)$/g

Perfetto, se volessi contemporaneamente rimuovere sia le
virgole che i punti, come potrei fare?




--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.