Note that there are some explanatory texts on larger screens.

plurals
  1. POfixing parenthesis in regex for linkify php function?
    primarykey
    data
    text
    <p>I've implemented "linkify" on our OSticket system and it seems to be working wonderfully, except for one noted flaw that I didn't notice in the documentiation <a href="http://jmrware.com/articles/2010/linkifyurl/linkify.php" rel="nofollow">http://jmrware.com/articles/2010/linkifyurl/linkify.php</a>. When the link is followed by a ), it INCLUDES that ) in the link. GRRR </p> <p>So I was wondering if there are any super regex guys out there that might be able to debug seeing as how linkify hasn't been updated in a couple years now...</p> <p>Here is the regex if needed:</p> <pre><code> $url_pattern = '/# Rev:20100913_0900 github.com\/jmrware\/LinkifyURL # Match http &amp; ftp URL that is not already linkified. # Alternative 1: URL delimited by (parentheses). (\() # $1 "(" start delimiter. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&amp;\'()*+,;=:\/?#[\]@%]+) # $2: URL. (\)) # $3: ")" end delimiter. | # Alternative 2: URL delimited by [square brackets]. (\[) # $4: "[" start delimiter. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&amp;\'()*+,;=:\/?#[\]@%]+) # $5: URL. (\]) # $6: "]" end delimiter. | # Alternative 3: URL delimited by {curly braces}. (\{) # $7: "{" start delimiter. ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&amp;\'()*+,;=:\/?#[\]@%]+) # $8: URL. (\}) # $9: "}" end delimiter. | # Alternative 4: URL delimited by &lt;angle brackets&gt;. (&lt;|&amp;(?:lt|\#60|\#x3c);) # $10: "&lt;" start delimiter (or HTML entity). ((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&amp;\'()*+,;=:\/?#[\]@%]+) # $11: URL. (&gt;|&amp;(?:gt|\#62|\#x3e);) # $12: "&gt;" end delimiter (or HTML entity). | # Alternative 5: URL not delimited by (), [], {} or &lt;&gt;. ( # $13: Prefix proving URL not already linked. (?: ^ # Can be a beginning of line or string, or | [^=\s\'"\]] # a non-"=", non-quote, non-"]", followed by ) \s*[\'"]? # optional whitespace and optional quote; | [^=\s]\s+ # or... a non-equals sign followed by whitespace. ) # End $13. Non-prelinkified-proof prefix. ( \b # $14: Other non-delimited URL. (?:ht|f)tps?:\/\/ # Required literal http, https, ftp or ftps prefix. [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]+ # All URI chars except "&amp;" (normal*). (?: # Either on a "&amp;" or at the end of URI. (?! # Allow a "&amp;" char only if not start of an... &amp;(?:gt|\#0*62|\#x0*3e); # HTML "&gt;" entity, or | &amp;(?:amp|apos|quot|\#0*3[49]|\#x0*2[27]); # a [&amp;\'"] entity if [.!&amp;\',:?;]? # followed by optional punctuation then (?:[^a-z0-9\-._~!$&amp;\'()*+,;=:\/?#[\]@%]|$) # a non-URI char or EOS. ) &amp; # If neg-assertion true, match "&amp;" (special). [a-z0-9\-._~!$\'()*+,;=:\/?#[\]@%]* # More non-&amp; URI chars (normal*). )* # Unroll-the-loop (special normal*)*. [a-z0-9\-_~$()*+=\/#[\]@%] # Last char can\'t be [.!&amp;\',;:?] ) # End $14. Other non-delimited URL. /imx'; </code></pre> <p>I started to play around with it, but it proves to be a bit over my head. I am also up for OTHER alternative suggestions instead of linkify as well?</p> <p>If you note the second to last line: <code># Last char can\'t be [.!&amp;\',;:?]</code> Basically, it'd be nice to add a ) in there.... ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload