Excuse me while I GREP in your face
I don’t hide the fact that I’m a geek, for a designer, I think I hold my own with most webdev programmers - In most regards I know my shit, but until recently I haven’t spent anytime learning regex (regular-expressions) and let me tell you, if you don’t know regex - simply put, you’re working too hard.
Regex is a way to filter strings that match a pattern out of text from a file or from standard input. Regular expressions (or RegExs) can be used with a big choice of programs, most notably grep (the global regular expression parser) and sed (the stream editor).
I know, even the definition is somewhat intimidating, but the power of regex is worth the pain I promise - let’s look at an example, take a look at the following list of fish (assuming that the number was a quantity).
- One Fish: 1
- Two Fish: 15
- Red Fish: 9
- Blue Fish: 0
And what we wanted to do was display the list but eliminate any fish that had a quantity of zero, throw a regex like ‘^.*0.*$’ at your text and you get back, now there is a flaw (it’s intentional) in my expression here, but I’ll let you figure it out.
- One Fish: 1
- Two Fish: 15
- Red Fish: 9
No looping, no conditional statements - just raw regex power, rather than fumble through a less-than-adequate explanation here’s 3 spectacular links to get you started.
- http://www.regular-expressions.info/tutorial.html
- http://www.regextester.com/
- http://en.wikipedia.org/wiki/Regex
If you come up with anything cool let me know
If you’re going to be playing with these, I highly suggest getting RegExhibit: http://homepage.mac.com/roger_jolly/software/index.html