
2/13/10
Saturday 2:08pm
Date Posted: 2/13/10
Terrible time to be burned out with this PCRE, but I am. Here is what the most recent one looks like:
$text=preg_replace("/-(?!((?!</?(script|style|a)b).)*(</(script|style|a>)))/is","–",$text);
It replaces all hyphens with dashes unless it is located within a javascript, style script, or hyperlink. Inline styling will have the hyphens replaced with dashes, but that can be fixed by using classes.
TAGS: noneAll Memo Tags
allegory 1,
anime 1,
article 6,
audio 2,
bible 5,
books 3,
bug 23,
code 1,
commercial 1,
computer 15,
cooking 5,
election 6,
ereader 5,
fixed 12,
games 24,
grok 4,
habits 2,
hard to remember 1,
history 1,
home improvement 44,
keyboard shortcuts 1,
links 3,
memo blog 1,
mini-review 14,
moving 19,
music 1,
mysql 1,
news 35,
none 1895,
opera 69,
politics 11,
private 17,
quotes 1,
reformat hard drive 19,
sgopc 1,
site update 15,
site version 205,
sleep 3,
star wars 2,
story 4,
swtor 1,
texas 1,
vacation 5,
video 7,
website 26,
windows 10 1,
wishlist 3