|
Paul Hudson wrote :I accept that people find regexps difficult, but it baffles me sometimes why. I don't recall(*) having a problem learning them. What aspects of them do people find difficult? (*) But since I first encountered them about 20 years ago, I may have forgotten the problems I had.with a gentler learning curve than regular expressions.
I think the main problem people have is that they are difficult to read 'at a glance'. Once you realise that they are often quite comprehensible once you start breaking them down, they become a lot easier, but a lot of people will look at them, and because they don't understand it immediately, the little switch that says 'I can't do this' trips, and they will say that regexps are hard and they can't do them without actually trying.
If people were introduced to regexps by things like gr[ea]y rather than \b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\bthey'd probably find them a lot easier... I think the difficulty is mainly a mind-set one rather than actual difficulty.
I find http://www.regularexpressions.info/ is a decent tutorial which covers the basics quickly, but lets you find out more if you need/want.
Paul VPOP3 - Internet Email Server/Gateway support@pscs.co.uk http://www.pscs.co.uk/