tags:

views:

111

answers:

11

Possible Duplicate:
Learning Regular Expressions

I have found lots of ways by googling. Now I am really confused what should I follow, Or which part of which way will be better to learn.

I think many of you have very good experiences and ideas about learning RegExp. Would you please share those experiences and/or ideas! that will be great to me as well most of others.

Thanks in advance- Sadat

+1  A: 

use something like rubular.com. you can interactively enter reg expressions and test for results against one or more string inputs.

Jed Schneider
A: 

I have found this designer (Regular Expression Designer)to be helpful. Obviously you would want to learn the basics of regular expressions, but this tool holds your hand a lot with explanations. Again, just a handy tool

RandomNoob
+4  A: 

I strongly recommend getting a good book like Mastering Regular Expressions by Jeffrey Friedl. You can read it front to back if you really want to learn how RegEx works or just use it as a reference. Combine that with a good tool like Expresso for practicing with.

TLiebe
This is one of my favorite texts. It covers the syntax well and explains why some regexs are faster than others.
orangeoctopus
@Tliebe, it seems very good tools.Is there any tools you know for linux(ubuntu) platform?
Sadat
Sorry @Sadat, I'm not familiar with any similar tools for linux.
TLiebe
pcretest - test perl compatible regexs
thegeek
A: 

read this excellent book mastering regular expression

thegeek
A: 

I agree about Jeffrey Friedl book and in addiction i suggest you http://www.regexplib.com/RETester.aspx

Cris
+2  A: 

There are two things I can recommend:

  • The book Mastering Regular Expressions is very comprehensive and worth having on your shelf if you find yourself needing a solid reference guide.

  • The software Regex Buddy is a great tool for creating, testing, and (most importantly) saving regular expressions across a bunch of different language implementations.

Both of these obviously cost money, so it depends upon your time vs. budget. But, in my case, I think both of these purchases paid for themselves pretty quickly.

Ben Hoffstein
+3  A: 

As with almost any kind of thing, you should choose whichever way that fits better you style.

But, in my opinion (since you're asking, after all), you should begin by trying. RegEx are a very practical thing: there isn't much theory to how they work (just some syntax to be memorized), but there are a lot of things to learn about them when they are put in practice.

So, practice. You can use nRegex if you are writing .Net regex, or you can use egrep if you are on a Linux machine. Start by getting some text document and then trying to find some expressions there.

I also use regex with my favorite editor (UltraEdit) to help me replace stuff. It's actually very useful if you work with large datasets which are stored as plain text files.

In this case, necessity was king. I was learning as I needed.

Bruno Brant
A: 

Wikipedia is a good starter. It explains what regular expression are and provides some links to tutorials for various regular expression dialects.

Andreas_D
+1  A: 

Now I am really confused what should I follow...

What are the ways? That's a question that can be addressed.

Otherwise, trial-and-error is the best way. The easiest time to learn is when there is something you have/want to solve. Textbook learning takes longer to comprehend the problem, before learning how to fix it.

Armando
A: 

trial and error with tools like this: http://rubular.com/

david
A: 

I'm surprised nobody has mentioned the Regular Expressions Cookbook yet. It contains hundreds of regex examples, with top-quality discussion of each one. It and MRE should be the only regex books you'll ever need.

Alan Moore