WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Modify make_clickable URL RegEx (1 post)

  1. Sven D.
    Member
    Posted 3 years ago #

    I would like to make a small change to WPs make_clickable RegEx for URLs so that a space og a line break is needed in front of the URL before it change the URL into a clickable one.

    My RegEx knownledge is limited, but i guess that something like this should cover space and linebreak on the Linux server i am on:

    ( |\n)

    But where do I put it in WPs RegEx:

    $retval = preg_replace_callback('
    #(?<!=[\'"])(?<=[*\')+.,;:!&$\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]{1,2000}|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is
    ', '_make_url_clickable_cb', $ret);

    Any help is much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.