KBD

Keith Devens .com

Friday, January 9, 2009 Flag waving
ALL YOUR BASE ARE BELONG TO US. – Zero Wing
← The most useful bookmarklets everAn optimization anecdote →

Daily link icon Wednesday, April 10, 2002

Continuing markup woes

Ok, I'm getting my markup under control Smiley Inline styles are fixed! The downside is that I'm having trouble trying to make a regular expression that wants this to be a hyperlink:

"sometext"="http://blah.com/"

The problem is, it'll match too much if there's a quoted string before one of those strings - it'll match from the beginning of the first quote to the end of the second quote. I need some way to say "match a quote, any text until you see another quote, a quote, an equals sign, a quote, and any text until you see another quote". Too late to explain in any more detail now. I'll leave you with the current regex I'm using:

/"(.+?)"[:=]"(.+?)"/=

You can tell that I'm doing HTML escaping before I do my matching Smiley To put it in terms of that, the first captured string is matching too much. Why?

By the way, the regex above works and is currently in use on my weblog. All the links you see are generated by it. Again, the only problem is that it sometimes matches too much, and I'm having trouble making the first captured string stop when it hits the first quote.

← The most useful bookmarklets everAn optimization anecdote →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

January 2009
SunMonTueWedThuFriSat
 123
45678910
11121314151617
18192021222324
25262728293031



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

Recent comments XML

The Elegant Universe

Well I have finally found the crazy​guy that preaches useless nonsence​in A...

Joseph Baxter: Jan 7, 11:07pm

I hate Norton Antivirus


SYMANTEC is very​cunning..
Symantec now have a​redeemable cash back offe...

CAN: Jan 4, 6:25pm

Spider solitaire

Hi everyone!

Glad to have found​this site.  I have enjoyed reading​the c...

flwrchld53: Jan 4, 5:30pm

Generated in about 0.238s.

(Used 8 db queries)

mobile phone