Avatar of electricd7
electricd7

asked on 

Need to find the value between <tag> </tag> using VBscript

Hello,

I have using msxml to scrape the contents of a webpage into a variable (myvar).  Now I want to use VBscript to store the string between 2 specific tags found in the source.  The tags data I want is held between the following:

<div id="myscore">137475</div>

So I want to search the entire myvar variable and end up with a new variable that only holds the value "137475".  Can somone write a function that does this?  Seems like it would be fairly easy to do using InStr, but my brain is asleep this morning!

ED7
VB Script

Avatar of undefined
Last Comment
Patrick Matthews
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of electricd7
electricd7

ASKER

I must not have RegExp installed?  I get an error on the line "With RegEx" that says:

Object required: 'RegEx'
Sorry, typo.  Change:

    With RegEx

Open in new window


to:

    With RegX

Open in new window

Avatar of electricd7
electricd7

ASKER

Perfect, thanks!
electricd7,

Glad to help!  If you have not already done so, I would really appreciate it if you could please return to my article
https://www.experts-exchange.com/Programming/Languages/Visual_Basic/A_1336-Using-Regular-Expressions-in-Visual-Basic-for-Applications-and-Visual-Basic-6.html
and click 'Yes' for the 'Was this helpful?' voting.

Patrick
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo