Click to See Complete Forum and Search --> : vbscript regular expressions


bjnst6
October 10th, 2002, 07:45 PM
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

websmith99
October 10th, 2002, 10:33 PM
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.

bjnst6
October 10th, 2002, 10:46 PM
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?

websmith99
October 11th, 2002, 12:22 AM
You can use both languages. They are just in separate script blocks where you specify the language.

bjnst6
October 11th, 2002, 01:06 AM
excellent. i'll definitely give that a try.
thanks...again! (and again...and again....)

b