KBD

Keith Devens .com

Monday, October 13, 2008 Flag waving
Although at the beginning the paradigm was worth consideration, now the entire effort in the primeval soup paradigm is self-... – Hubert P. Yockey (Information Theory and Molecular Biology, p336)

Archive: December 08, 2004

← December 07, 2004December 09, 2004 →

Daily link icon Wednesday, December 8, 2004

Regular expression question

It's pretty trivial to split a key:value pair with a regular expression. Something like /^\s*([^:]+)\s*:\s*(.*?)\s*$/ can do the job. But how can you do it if you want to allow escaped colons in your key?

Say you allow the escapes "\\" → '\' and "\:" → ':' in your key. Is there any way to use a regular expression to split the key and value while ignoring a "\:"? Keep in mind that that could actually be "\\:" in which case you still should split on that colon because it's actually the backslash that's escaped. So, a simple one character lookbehind isn't sufficient.

Any solutions?

  1. John Podhoretz on how liberals think Bush is the "Evil Doofus". I came across this yesterday and wasn't planning on blogging it until I realized when seeing him on Fox News this morning that the "Evil Doofus" thing is exactly the opinion my friend has about Bush (see the end).

       (0) Tags: [Opinions/Politics]
  2. Signs of optimism on Iraq from Andrew Sullivan, via PoliPundit.

       (0) Tags: [Opinions/Politics]
  3. Michael Paulus has made fascinating drawings of some cartoon character skeletal systems. Peppermint Patty is particularly freaky, as are the Powerpuff Girls.

       (1) Tags: [Random]
← December 07, 2004December 09, 2004 →
October 2008
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
262728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 7 posts

Recent comments XML

new⇒Spider solitaire

I have now won, at the "Difficult"​level, 186 games of Spider​Solitaire.  I...

75.179.28.113: Oct 13, 9:34am

new⇒Girls, please don't get breast implants

Please, don't marry him.

You​want to get surgery to make​yourself more i...

gigi: Oct 12, 11:47pm

I hate PHP

Elliot Anderson,

Dude!! You the​man! The reverse replacement for​array_u...

Alex Ndungu: Oct 11, 1:35am

Call a function from a string in Python

?!code:
some_object.__getattribute​__('method_name')()
?!/code

is​the s...

Patrick Corcoran: Oct 8, 3:53pm

Sed one-liners

Hi.

I wanted to let you know​that I wrote an article "Famous Sed​One-Lin...

Peteris Krumins: Oct 8, 3:05am

Timesheet Calculator

Hadn't seen it before now, but my​company already uses a time​tracking prog...

Keith: Oct 7, 10:44am

Generated in about 0.056s.

(Used 7 db queries)

mobile phone