Wildcards in ASP Replace String

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • david.n.holley@gmail.com

    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!

  • Evertjan.

    #2
    Re: Wildcards in ASP Replace String

    wrote on 08 sep 2007 in microsoft.publi c.inetserver.as p.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(h r1,"")

    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)

    Comment

    • david.n.holley@gmail.com

      #3
      Re: Wildcards in ASP Replace String

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

      THANK YOU!

      Comment

      • Evertjan.

        #4
        Re: Wildcards in ASP Replace String

        wrote on 09 sep 2007 in microsoft.publi c.inetserver.as p.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)

        Comment

        Working...