views:

673

answers:

5

Hey,

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  A: 

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

Sunny
+6  A: 

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

Dror Helper
Yay Thank you, the application's nice, I just have to learn how to work with that :)
Skuta
+2  A: 

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.

RaphaelSP
A: 

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.

Jaykul
A: 

Hello Everyone

i got a quite similar problem. i have some 130,000 strings in database i want to write a utility that can generate regular expressions for these strings in c#.NET. i m new to .NET and never used regex before neither do i know if this is even possible. can we automate regex i.e read set of strings and build regex based on those string values

any help and suggestion is highly appreciated

Muhammad Adeel Zahid