SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist Alchemist's Avatar
    Join Date
    Aug 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    REGEXP uppercases and double quotes

    Hello all,


    I'm trying to solve three minor problems with vbscript REGEXP.

    1) I want to find any occurences of and|or|not in a string and capitalize them.

    regEx.Pattern = "(\s)(and|or|not)(\s)"
    KW = trim(regEx.Replace(KW, "$1" & ucase("$2") & "$3"))

    how come this is not working?

    2) when highlighting words (in a search results page for example), I want to match the word ignoring case. however, when wrapping the word in highlighting code and replacing the substring, I want to keep the original capitalization.

    regEx.Pattern = "(^|\s|[^a-z0-9])" & highlitetemp(iTemp) & "(\s|$|[^a-z0-9])"
    Body = trim(regEx.Replace(Body, "$1<span class=highlite>" & highlitetemp(iTemp) & "</span>$2"))

    for example, if the word to match is marvelous, but the word is stored uppercase in the db, the above code will replace the word with a lowercase version. how do I get around this?

    3) I want to remove any and|or that are not inside double quotes in a string. for example,

    test = """The dog and the cat""" & " and fox or mouse " & """the cat and the dog"""

    resulting in "The dog and the cat" and fox or mouse "the cat and the dog"

    I would like to remove only the AND OR linking fox and mouse in the middle of the string. how would I do that?

    thanks in advance!!!!!

  2. #2
    SitePoint Evangelist Alchemist's Avatar
    Join Date
    Aug 2006
    Posts
    412
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •