WordPress.org

Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #48261, comment 4


Ignore:
Timestamp:
10/09/2019 09:51:19 PM (6 weeks ago)
Author:
birgire
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #48261, comment 4

    v2 v3  
    44
    55This patch adds the extra condition {{{preg_match( '#(?:^\s*|\s+)rel\s*=#', $link_html )}}} if the attributes-regex are matched. Here {{{(?:)}}} is a non-capturing group and we check if rel is the first attribute (that can be without white space from left in {{{$link_html}}}) or the second (or later) attribute (that need a white space from left in {{{$link_html}}}). I first tried to modify the existing attributes-regex with this approach but it ended up with more changes, so I currently prefer this approach.
     6
     7ps: we could simplify to {{{preg_match( '#(^\s*|\s+)rel\s*=#', $link_html )}}} as the first version was when I tested it within the attributes-regex, with existing capturing groups.