CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2002
    Location
    PA
    Posts
    36

    vbscript regular expressions

    yes indeed...

    I have a string that looks like this:

    "This is always the same, same, same, but this color name here: yellow could be anything"

    I need to search for all the occurences of this string. Now the problem comes in because I need to search for the length of the whole string from "This" to "anything" and return that whole part of it...but the color name could be anything, of any LENGTH. now it's separated by the same characters on each side...like spaces here for instance, so I know when the word ends (they're will be a space...but it could be "red" or "green", etc.

    my question is how do i set the regular expression to be okay with finding anything in place of the "yellow" of any length?

    this code will work as a search string if the color name is a fixed number of characters, like 6 in the "yellow" example above...but it won't be:

    RegExpTest "This is always the same, same, same, but this color name here: ...... could be anything", testFile

    any ideas?
    word,
    b

  2. #2
    Join Date
    Aug 2002
    Location
    Reykjavik, Iceland
    Posts
    201
    Are you using an ASP architecture? If so, then you can also use JavaScript. JavaScript has some pretty powerful regular expression syntax very similar to that of perl.

  3. #3
    Join Date
    Aug 2002
    Location
    PA
    Posts
    36
    that sounds good...but doesn't that mean that i'll have to write all my script for this application in javascript? or can i just specify a certain part in javascript?

  4. #4
    Join Date
    Aug 2002
    Location
    Reykjavik, Iceland
    Posts
    201
    You can use both languages. They are just in separate script blocks where you specify the language.

  5. #5
    Join Date
    Aug 2002
    Location
    PA
    Posts
    36
    excellent. i'll definitely give that a try.
    thanks...again! (and again...and again....)

    b

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured