Wildcards in ASP Replace String

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!
david.n.holley [ Sa, 08 September 2007 21:18 ] [ ID #1815635 ]

Re: Wildcards in ASP Replace String

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)
exjxw.hannivoort [ Sa, 08 September 2007 23:44 ] [ ID #1815636 ]

Re: Wildcards in ASP Replace String

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

THANK YOU!
david.n.holley [ So, 09 September 2007 03:40 ] [ ID #1816051 ]

Re: Wildcards in ASP Replace String

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)
exjxw.hannivoort [ So, 09 September 2007 10:05 ] [ ID #1816052 ]
Webserver » microsoft.public.inetserver.asp.general » Wildcards in ASP Replace String

Vorheriges Thema: Connection of ASP and MS ACCESS using file dsn
Nächstes Thema: Refresh IFRAME via ASP