Need help with your business technology?

p: (415) 409-9557 e: adria@butyoureagirl.com

My First Regular Expression

I’m cleaning up my Delicious bookmarks and although there is “bulk edit”, you cannot perform a search and then execute the bulk edit. I was removing a bunch of photos from Twitpic that had been pulled into Delicious using Packrati.us, an app that connects your Twitter account to your Delicious bookmarks.

So, after Googling, I realized I was going to need to export, search & replace then upload my bookmarks. This would be a perfect opportunity to use my newly budding programming skills!

I checked out regular expressions and eventually came up with this code snippet which selected two full lines of code allowing me to do search and replace quiclkly!
My first regular expression

<DT><A HREF="http://twitpic.com(/.*)[A-Z0-9]*?</A>n<DD>[A-Z0-9].*

This code is searching for characters that match.

[A-Z0-9]

works wonderful to span sentences and I found out it was

 $/n 

to continue searching on the next line (The dollar sign isn’t necessary to start a new line but I couldn’t get the anchor to show otherwise)

 helped me cleanup whitespace left after the search and replace

These resources helped me get this expression setup
http://www.regular-expressions.info/brackets.html
http://www.regular-expressions.info/anchors.html
http://www.araxis.com/merge/topic_regexpreference.html

I've also realized that learning to program is important because Grace Murry Hopper and Ada Lovelace both tackled it. So can I!

Blog Widget by LinkWithin
  • http://packrati.us Ratius T. Packrat

    Hey, Andria. Welcome to the wonderful world of regexes. Ratius T. Packrat, here, from over at http://packrati.us. A lot of folks don't like Twitpic photos, FourSquare locations, and similar things posted to delicious. We have a feature for that. See the “Exclude sources” section in preferences. Just add “Twitpic”. Then we'll skip statuses from Twitpic and they won't end up in your delicious bookmarks.

  • http://twitter.com/particleion carlos mejia

    Your such a nerd adria, this is what keeps bringing me back.. lol nice!

  • http://markjaquith.com/ Mark Jaquith

    Regular expressions are one of the purest joys you can find while coding.

  • http://twitter.com/particleion carlos mejia

    Your such a nerd adria, this is what keeps bringing me back.. lol nice!

  • http://markjaquith.com/ Mark Jaquith

    Regular expressions are one of the purest joys you can find while coding.