Geek Alert!

• Views: 874

I’m stuck on a problem involving regular expressions, and thought I’d appeal to our geekbase to see if anyone can provide a solution.

In our comments, occasionally someone will post a link by typing in the “

And for some reason this drives most web browsers insane, producing bizarre and unpredictable displays.

Can a regex geek (I’m sure there are hordes of regex geeks reading this) suggest a way to make sure that the attributes inside an tag are properly surrounded by quotes? (Preferably in a PHP kinda flavor?)

UPDATE: LGF reader Hovig John Heghinian suggested a good solution:

ereg_replace(‘(<[aA] [^>]*[^”])>’, ‘\1”>’, $s);

or

preg_replace(‘/(<[aA] [^>]*[^”])>/’, ‘$1”>’, $s);

Jump to top

Create a PageThis is the LGF Pages posting bookmarklet. To use it, drag this button to your browser's bookmark bar, and title it 'LGF Pages' (or whatever you like). Then browse to a site you want to post, select some text on the page to use for a quote, click the bookmarklet, and the Pages posting window will appear with the title, text, and any embedded video or audio files already filled in, ready to go.
Or... you can just click this button to open the Pages posting window right away.
Last updated: 2023-04-04 11:11 am PDT
LGF User's Guide RSS Feeds

Help support Little Green Footballs!

Subscribe now for ad-free access!Register and sign in to a free LGF account before subscribing, and your ad-free access will be automatically enabled.

Donate with
PayPal
Cash.app
Recent PagesClick to refresh
Ranked-Choice Voting Has Challenged the Status Quo. Its Popularity Will Be Tested in November. JUNEAU — Alaska’s new election system — with open primaries and ranked voting — has been a model for those in other states who are frustrated by political polarization and a sense that voters lack real choice at the ...
Cheechako
2 weeks ago
Views: 271 • Comments: 0 • Rating: 1