Emacs Lisp Exercise of the Day: extract-url

Emacs Lisp Exercise of the Day: extract-url

Here's a fun exercise: write a command “extract-url” that will extract all url in a text selection and put them in a buffer.

For example, suppose you have this text:

<div>1, <a href="iraq_pixra2.html">2</a>, <a href="http://en.wikipedia.org/wiki/Idiom">Idiom</a>, <a href="iraq_pixra3.html">3</a></div>

After calling the command, you'll get in a separate buffer this text, one url per line:


You can assume that the url will always be in href="…". For extra bonus, also extract URL enclosed in single quotes: href='…'. The extracted URLs must be in the order they apppear.

I'll post a solution tomorrow.

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?