AOB
Well-known Member
- Joined
- Dec 15, 2010
- Messages
- 669
- Office Version
- 365
- 2016
- 2013
- Platform
- Windows
I'm trying to extract the URL and display text of a HTML hyperlink tag in the form of a simple string variable.
So the string variable will hold a value along the lines of :
And I want to pull out the URL ("https://www.somewebsite.com") and the display text ("Visit Some Website") into two separate string variables somehow.
Bearing in mind, I don't have control over the source HTML tag that fills the original string variable (i.e. there may be whitespace/s between the
Pretty sure a couple of regex's are the answer here but struggling to come up with the pattern(s) if anybody might have any pointers?
Thanks!
So the string variable will hold a value along the lines of :
HTML:
<a href="https://www.somewebsite.com">Visit Some Website</a>
And I want to pull out the URL ("https://www.somewebsite.com") and the display text ("Visit Some Website") into two separate string variables somehow.
Bearing in mind, I don't have control over the source HTML tag that fills the original string variable (i.e. there may be whitespace/s between the
<a
tag and the href
etc. - so I need something consistent & reliable to account for that)Pretty sure a couple of regex's are the answer here but struggling to come up with the pattern(s) if anybody might have any pointers?
Thanks!
Last edited: