I would like to get some text of html page I’m navigating It’s a program version numbers
"(\d\.\d\.\d\.\d)" The regex code.
I want to execute this command in webBrowser1_DocumentCompleted
Something like this
string html = webBrowser1.Document.Body.InnerText;
// scrape keywords version = Regex.Match(html, @"""(\\d\\.\\d\\.\\d\\.\\d)""",RegexOptions.IgnoreCase).Groups[0].Value;
Which doesn’t seem to work. (The text I’m trying to find isn’t in body or any place specified I need just grab the whole html code and find it there)
I can confirm this what is not working is the way I get HTML text, I need alternative way because there is no or body or anything I just need the whole webbrowser text and use the regex (Regex works fine I think)
This RegEx
\d\.?will match the version number in this HTML:Bear in mind that there are four matches returned so when using it you’ll need to get the entire match instead of individual groups.
So, you might use it like this:
Another possible RegEx that’s more specific too would be
((\d\.){3}\d{1}). This RegEx will capture the specific version number twice in the following string, HTML or JavaScript, doesn’t matter. But it will ignore the3.4.2.To retrieve the text of the web page the
WebBrowsercontrol is currently on try the following code in theDocumentCompletedevent handler: