MantisBT: master 8198742d

Author Committer Branch Timestamp Parent
Julian Fitzell master 2003-03-16 19:25 master 5d61610f
Changeset

Improve the email and href parsing regexes a little. Also add descriptive comments since regexes are rarely capable of standing on their own.

Read the comments for details on the new rules but I tested them pretty thoroughly and they seem to work satisfactorily. Let me know if anyone finds issues.

Note that we really need to do this with a parse tree. Or at least replace the urls and emails with some marker and then put them back in later. Parsing the whole thing repeatedly caused me all kinds of problems like emails matching already matched URLs, having to match entities instead of the real characters, etc. These problems force us to tighten the rules used to match emails (like enforcing a subset of characters preceding email addresses). I may do this at some point but not now.

  • core/string_api.php
    (string_insert_hrefs): redo regexes to be more comprehensive
    (string_strip_hrefs): match much more generally, including href anchors
    with other attributes or extraneous whitespace

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2106 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9

mod - core/string_api.php Diff File