[wp-trac] [WordPress Trac] #24225: Improve regular expressions when matching attributes

WordPress Trac noreply at wordpress.org
Fri Oct 17 10:50:57 UTC 2014


#24225: Improve regular expressions when matching attributes
-------------------------+------------------------
 Reporter:  kovshenin    |       Owner:  kovshenin
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  4.1
Component:  Formatting   |     Version:  3.6
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------

Comment (by kovshenin):

 > But it doesn't work in PHP :) I don't really know why.

 Oh I know why, it's hitting the backtrack limit :) we can put the non-
 quote-or-quote match in an atomic group, like this:

 {{{
 /(class=(["\'])(?>[^\'"]|(?!\2).)*?)align(none|left|right|center).*?\2/
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/24225#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list