Regex-Bar

Here are my slides on my lightning talk today about regex. For the most part, I need to give credit to Juliette Folmer, a true regex master, for the talk she gave at PHPCon London, which re-kindled my interest in regex, and also taught me some new things (two of which are in the talk today).

If anyone spots anything wrong with the slides do let me know – it’s more than likely, since I literally had about 15 mins to prepare them!!

Anyhoo, here are the slides:

Hopefully the slides make sense without the talk!! If anyone wants to ask any questions about it, please drop me a note, or post a comment below!! As I said, I think the examples should be ok, but I’ve not really checked them, so please point out any inaccuracies, and I will correct!!

Share This

As I mentioned at work, I know this one and I use it in Dreamweaver all the time:

Find: (.*)

Replace: $1

For example, if some divs only had a class of cheese and not pineapple. If you didn’t need either, you could replace both with caterpillar.

I sometimes use it across our ‘essays’ sections. Free (.*) Essays. F&R across the whole root for Free $1 Essay Samples for instance.

Those are probably bad examples. Hahaha.

Also Liam, Free SEO / Traffic building tip: you should get your slides up on Slideshow sites (I think Slide is one such site), and link back to your site for some google loves. You can usually paste the slideshow into your blog too so people can view them in order. Ooh fancy!

oh, it removed my code. :(

Thanks for the SEO tip – I’ve only just walked through the door, so prob. not going to do it tonight, but will look at it tomorrow!! As for the regex, replaces like that are certainly useful, although that’s not all regex can be used for. Also, as I said in the slides, . is very slow, you would be much better using

/free [a-z -]+ essays/i
and then in the replace, using

free $1 essay samples

will be quicker :) . Of course, if your word in between contains more than just a-z, spaces and hypens, you need to include those as well.

Ohh thanks for the tip, I’ll give that a look on Monday :-)

Nice brief and this fill someone in on helped me alot in my college assignement. Thank you as your information.

Leave a Comment