Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular expression to remove letters in classic asp 1

Status
Not open for further replies.

panini

MIS
Jun 1, 2001
136
GB
Hi there,

A numeric (cash) variable I am working with is having extra characters added to it in different browsers and os's on it's path through scrapes and javascript links.

Just before i use the variable again in asp i want to clean it up and get rid of everything apart from numbers and a decimal point. Can anyone help me with a regular expression to do this - or any other way - i'm open to ideas!

Many thanks
 
[tt]
'given string s
set rx=new regexp
with rx
.pattern="[^\d\.]"
.global=true
end with
t=rx.replace(s,"") 'desired stripped answer
[/tt]
 
You may also want to add

set rx=nothing to the end of that code

[bigglasses]

Army : Combat Engineer : 21B

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top