▼  Site Navigation Main Articles News Search  ▼  Anime + Manga Anime Reviews Anime Characters Gallery Screenshots Manga Reviews  ▼  Misc Links to Webcomics Bible Quotes About Older Musings
site version 7.3
older
newer

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","&ndash;",$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.

archives


TAGS: none

All Memo Tags

allegory 1, anime 1, article 6, audio 2, bible 4, books 3, bug 20, code 1, commercial 1, computer 15, election 6, ereader 5, fixed 11, games 24, grok 3, habits 2, hard to remember 1, history 1, keyboard shortcuts 1, links 3, memo blog 1, mini-review 12, moving 2, music 1, mysql 1, news 35, none 1873, opera 69, politics 11, private 16, 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 25, windows 10 1, wishlist 3

copyright 2005–2024