michaelli321 Posted August 26, 2011 Share Posted August 26, 2011 I was just on Chapter 13, and it seems the whole chapter has to do with patterns, and matching them. I do not see any point in this. Could anybody give me an example of when this information would be needed? Link to comment Share on other sites More sharing options...
Jonathon Posted August 26, 2011 Share Posted August 26, 2011 Regular expressions? They are incredibly useful, but can be confusing to start with. You can use them in .htaccess files to make pretty urls and more importantly help validate types of input of varying types of complexities. Check out regexlib in Google, you'll where they're used. Things like validating telephone numbers, post codes and a lot more. Link to comment Share on other sites More sharing options...
HartleySan Posted August 27, 2011 Share Posted August 27, 2011 You ever wonder how Google's search engine works? Well, it's complicated for sure, but a huge part of it is using regular expressions to properly parse the search string. So yeah, they're ultra useful. Link to comment Share on other sites More sharing options...
Larry Posted August 27, 2011 Share Posted August 27, 2011 Without exaggeration, regular expressions are one of the most important and useful inventions in the history of computers and programming. Period. So much of what's done by software is searching for things, whether it's text within strings or files within a directory. Without regular expressions you can only search for specific, literal things. For example, it'd take two searches to find every file that's a .jpg or .jpeg. Or four, if you factor in case sensitivity. With regular expressions, that's one search. Matching email addresses, phone numbers, names, postal codes, URLs, other numbers, and so forth, all requires regular expressions. Which is to say that a ton of security is added by using regex. Yes, regular expressions is all about matching patterns, but that's kind of like saying that airplanes are just about allowing you to travel through the air. Compared to the alternatives, it's a pretty big difference. Link to comment Share on other sites More sharing options...
HartleySan Posted August 27, 2011 Share Posted August 27, 2011 I like that airplane analogy. Got a laugh out of that. Link to comment Share on other sites More sharing options...
Larry Posted August 27, 2011 Share Posted August 27, 2011 Well, I do like my analogies... Link to comment Share on other sites More sharing options...
Recommended Posts