Support » Plugins » Hacks » Modify make_clickable URL RegEx

  • Resolved Sven D.

    (@sven-d)


    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.

  • The topic ‘Modify make_clickable URL RegEx’ is closed to new replies.