WordPress.org

Make WordPress Core

Ticket #10823: 10823.2.diff

File 10823.2.diff, 905 bytes (added by solarissmoke, 7 years ago)

Use \w instead of [^\s]

  • wp-includes/formatting.php

     
    755755        $username = remove_accents( $username );
    756756        // Kill octets
    757757        $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    758         $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
     758        $username = preg_replace( '/&\w+?;/', '', $username ); // Kill entities
    759759
    760760        // If strict, reduce to ASCII for max portability.
    761761        if ( $strict )
     
    845845        }
    846846
    847847        $title = strtolower($title);
    848         $title = preg_replace('/&.+?;/', '', $title); // kill entities
     848        $title = preg_replace('/&\w.+?;/', '', $title); // kill entities
    849849        $title = str_replace('.', '-', $title);
    850850        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
    851851        $title = preg_replace('/\s+/', '-', $title);