Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking if string has certain text in it

Status
Not open for further replies.

gio2888

Technical User
Oct 26, 2000
64
US
Hi, this is what I want to do. Say I have url strings

s = "t = "
I want to use a if statement to check if the string has the part "portal.asp?category=". So in this case string s will return true...since it has that segment of text. String t will be false.

if s "this is the part I need" then

Thanks
Wayne
 
you could do a match like this
<script language=&quot;VBScript&quot;>
Dim regEx, Match, Matches
Set regEx = New RegExp
regEx.Pattern = &quot;portal\.asp\?category\=&quot;
regEx.IgnoreCase = True
regEx.Global = true
str = &quot;Set Matches = regEx.Execute(str)
For Each Match in Matches
newstr = newstr & Match.Value
Next
alert newstr
</script> A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top