Is there an Application to Create Regular Expressi

2019-04-30 20:14发布

问题:

I hope this is programmer-related question. I'm in the hobby business of C# programming. For my own purposes I need to parse html files and the best idea is..regular expression. As many found out, it's quite time consuming to learn them and thus I'm quite interested if you know about some application that would be able to take input (piece of any code), understand what i need (by Me selecting a piece of the code I need to "cut out"), and give me the proper regular expression for it or more options.

As I've heard, Regex is a little science of itself, so it might not be as easy as I'd imagine.

回答1:

Yes there is Roy Osherove wrote exactly what you're looking for - regulazy



回答2:

Not real answer to your question, as it has nothing to do with regex, but HtmlAgilityPack may help you with your parsing.



回答3:

You might also want to try txt2re : http://txt2re.com/, which tries to identify patterns in a user-supplied string and allows to build a regex out of them.



回答4:

I gotta agree with Sunny on this one: if you're parsing html, you're better off converting it to XML (using the HTML Agility pack it's trivially easy) and then you can using XPATH expressions rather than regular expressions, it's far better suited to the job.