Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Why is learning Regex's so hard? Can you direct me to the best, and most efficient way to learn Regex's without stabbing myself in the eye with a pencil!!!
Last edited by yanghwanim; 06-05-2009 at 02:30 PM.
O'riley's RegEx book, vim to create test files, and grep to play with them. And a bit of time to try, test, and practice.
The copy of the book that I have is falling apart, but I've never read the thing cover to cover. I find something that I'd like to be able to do, use the book as a reference, then try out what I've read. I use a lot of regex's in the spam filter on our mail system at work, so I use them a lot, but when there's one that's a little tricky, I still create a test file and play with grep. It may not be the fastest way to learn, but I figure that by the time I retire in 10 years or so, I may not need the book anymore!
to someone who is starting out, its normal. however, basic string manipulation doesn't really need to involve regular expressions that much if you choice of tools/languages used provides you excellent string manipulation capabilities/functions.
Remember a bunch of characters that have a special meaning in certain contexts---and then remember which ones have different special meanings in different utilities.
Learn how to use the "\" (escape) character to change the meaning of a character from special to literal (or vice-versa) depending on context.
Learn about extended Regexes which add more special characters, and which may or may not require the use of of even more special characters to tell the program whether the characters are special.....depending on context.
Learn all about quoting and why a double-quote is weaker than a single, and how to flip between strong and weak coding, and how to quote a quote.
AND---how some programs allow you to change what is special on the fly.
Well, just for your info, I never learned regex ... and probably never will, for the reasons pixellany has laid out. I just look at the sites I gave and go from there. I don't use it all that often anyway.
I like to keep an eye on regex threads - even if I don't (or can't) answer.
Some of the answers are amazing ... great learning tool to try and figure them (the answers !!!) out sometimes
There are some good links above; the book Mastering Regular Expressions http://regex.info/ is definitely very good.
As well as showing the basics, it also shows that different langs/tools use different 'regex engines', so the syntax for one tool may not do the same thing (or anything) in another tool.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.