Answer the question
In order to leave comments, you need to log in
How to apply a regular expression to a web page?
Hello. There is a .net project written in c#.
The awesomium control displays a web page. We need to show the user what their regular expression looks like on the page. For example, to highlight all links of the form: <a href="(?<link>.*?)">(?<title>.*?)</a>.
By "highlighting" is meant simply adding some style <div style="background-color: red"/>
to me, two solutions come to mind:
1) Execute a JS script.
2) Save a local copy of the web page and work with it already.
Hence the problems:
1) Regular expressions are written in the syntax applicable to .net. As it turned out, there are some differences in js, and there are also elements that are not present at all (named groups). Even if you try to replace incompatible elements, then it was not possible to execute complex regular expressions through regexp.
2) Everything is simple here: full compatibility, finds all matches and marks. But the saved page (if the content is generated automatically) differs from the original, i.e. may be missing images or even all css styles. I thought at first to save the page to some mht archive, but chromium (which underlies awesomium) refuses to display them later.
How would I solve such a problem? Maybe you know of projects that will be able to correctly download the entire web page locally.
Answer the question
In order to leave comments, you need to log in
you can just cache the entire page........ and the differences in the regular expressions of sharp and javascript - so you have to decide what to apply them to and at what stage, from this the solutions will be different.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question