I want to get all the "a" elements with the href attribute in this form: http(s)://any.example.com
, where any
can be a string containing just letters and/or numbers.
I'm new to Regex and XPath, so I can't get it right.
I figured out the Regex, but I'm not sure if it's 100% correct:
/(http|https)://+[A-Za-z0-9]+\.example+\.+com/
So the XPath would look like this:
document.evaluate("//a[@href='/(http|https)://+[A-Za-z0-9]+\.google+\.+com/']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
but it doesn't work.
I would appreciate if someone could help me.