Wildcards in ASP Replace String
am 08.09.2007 21:18:21 von 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!
Re: Wildcards in ASP Replace String
am 08.09.2007 23:44:54 von exjxw.hannivoort
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(/:.*$/,"")
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Re: Wildcards in ASP Replace String
am 09.09.2007 10:05:59 von exjxw.hannivoort
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]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)