Mar 29, 2001, 6:16 AM
Post #6 of 6
Actually I'm not sure regex can become much simpler because of their power and flexibility.
Re: how come this doesnt work??
[In reply to]
Some simple actions may be performed through Perl string functions, like split, but more powerful things will require some complex system in order to allow advanced definitions, and that's what regex is.
You can try "Mastering Regular Expressions" book from O'Reily, though most things I need I've learned from regular, i.e. non-regex specific, books. My favorite is "Perl Core Language - Little Black Book" by Steven Holzner, which covers most issues covered in other books.
And I'll try to give you the hint on how I read the regex - hopefully that'll help you at least a little:
Read the regex from the beginning, character after character with quantifiers (*+?) and line begin(^)-end($) characters attached to the last character or group of characters.
I'd read that as following:
/a/ = 'a' character,
/\s*/ = any number and combination of space and tab characters - possibly none,
/b/ = 'b' character,
/c?/ = 'c' character - optional, i.e. may not exist and regex will still match,
/.+/ = any number of any characters - at least one character is required
d$ = 'd' character appears as the last character of the string.
QA Engineer @ Extent Technologies, Ltd.