Daily Newz

1 min read

The year the hype died and The Floppies.

Crouching Tiger, Hidden Dragon is finally playing locally. We're planning on going to see it this afternoon.

Apple Computer's Shares Aren't Flying Like Jobs. Yada, yada… not funny… blah, blah… yadi, yadi.

Ich bin Mac OS X.

Red Hat 6.2:

Sun: Server-Side Up. Forte is indeed a great tool. Win2k not supported? I don't think so! Get your facts straight, people.

I just discovered a nitfy set of Java tools:

Gates, Allen lose billions in market. I wonder how Larry's fairing?

Another update to my IE bookmarks to OPML script is now available. It specifically deals with inconsistencies between Windows and Mac OS exported bookmarks. Thanks to Nat Irons for pointing out some of my Perl idiocrasies.

While dealing with the update, I've been faced with an interesting problem involving Perl's regular expressions. As I have yet to find an elegant solution, I'll try to summarize the problem below. Hopefully someone will be able to provide some assistance.

Here we go…

Regular Expressions Dilemma

Given the following example string:

"Tango & Cash, Batman & Robin, First & Last , AT&T"
The goal is to create a matching regular expression which replaces all occurrences of "&" with it's HTML entity, "&". Other valid HTML entities, such as "&", ">", "&", etc., must also remain untouched. Of course using the standard "s/&/&/g" would fail miserably.

Please share you thoughts. Join now if you're not already a member and/or click the discuss link below.

[Update]

Aaron Straup Cope sent me the following matching pattern:

s/&(?!(#[0-9]+|#x[0-9a-fA-F]+|w+);)/&/g

He found it at:

http://xmlhack.com/read.php?item=638

I've updated my script accordingly.

Thanks Aaron.