in reply to Regex Learning Tool
I learned the mastery of regex's by reading MRE, and literally sitting around figuring out how to get/match pieces of strings. I would propose this as a better tool to teach REs...
Give a string(s), then give problems, such as:
* Use a RE to find how many occurences of 'X' are in the string
* Use s!!! to substitute the first occurence of 'X' with 'Y'
* Use s!!! to substitue the second occurence (only) of 'X' with 'Y'
* Use an RE to see if the string 'X' can be matched in 'Y', disregarding quotes..
* etc...
Basically, that's what I did (as well as reading MJD's article on how the RE engine works, and other topical articles). And, I think that it worked quite well.. I haven't struggled with REs ever since.
I would be happy to help anyone come up with such exercises. Just ask if anyone wants to do it.
Cheers,
KM
|
|---|