Skip to content

Commit

Permalink
Improve RegEx for ftp address to not match emails.
Browse files Browse the repository at this point in the history
  • Loading branch information
OlyaHryhorenko committed Dec 27, 2023
1 parent b32854f commit 2b7684f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -3135,8 +3135,8 @@ function make_clickable( $text ) {

$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );

$ret = preg_replace_callback( '#(^ftp://([a-zA-Z0-9.-]+)(:\d+)?(/[a-zA-Z0-9._/%-]*)?$)#i', '_make_web_ftp_clickable_cb', $ret );
$ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
$ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );

$ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
$r .= $ret;
Expand Down

0 comments on commit 2b7684f

Please sign in to comment.