Wildcards in ASP Replace String

D

david.n.holley

I want to replace everything after a colon :)) in a string using ASP
Replace.

Here's an example of the procedure I want to perform:

dim hr1, hr1replace
hr1 = "H.R. 1908: Patent Reform Act of 2007 (On Passage)"
hr1replace = REPLACE(hr1,": [WILDCARD GOES HERE]","")

so the remaining text is only: H.R. 1908

I'm not sure if this is possible to do - but any suggestions you have
would be greatly appreciated.

THANKS!
 
E

Evertjan.

wrote on 08 sep 2007 in microsoft.public.inetserver.asp.general:
I want to replace everything after a colon :)) in a string using ASP
Replace.

There is no asp replace,
since asp is not a language but a platform,
having vbscript and jscript as languages.
Here's an example of the procedure I want to perform:

dim hr1, hr1replace
hr1 = "H.R. 1908: Patent Reform Act of 2007 (On Passage)"
hr1replace = REPLACE(hr1,": [WILDCARD GOES HERE]","")

so the remaining text is only: H.R. 1908

Use regular expression in vbscript:

hr1 = "H.R. 1908: Patent Reform Act of 2007 (On Passage)"
Set regEx = New RegExp
regEx.Pattern = ":.*$"
hr1replace = regEx.Replace(hr1,"")

or the same in jscript, much nicer:

hr1 = "H.R. 1908: Patent Reform Act of 2007 (On Passage)"
hr1replace = hr1.replace(/:.*$/,"")
 
D

david.n.holley

Worked like a charm - couldn't really find the simple answer to this
anywhere.

THANK YOU!
 
E

Evertjan.

wrote on 09 sep 2007 in microsoft.public.inetserver.asp.general:
Worked like a charm - couldn't really find the simple answer to this
anywhere.

Without quoting usenet users do not know what you are respondning on.
This is not email.

[please always quote on usenet]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top