208 | | $comment_regex = |
209 | | '!' // Start of comment, after the <. |
210 | | . '(?:' // Unroll the loop: Consume everything until --> is found. |
211 | | . '-(?!->)' // Dash not followed by end of comment. |
212 | | . '[^\-]*+' // Consume non-dashes. |
213 | | . ')*+' // Loop possessively. |
214 | | . '(?:-->)?'; // End of comment. If not found, match all input. |
215 | | |
| 208 | $comment_regex = |
| 209 | '!' // Start of comment, after the <. |
| 210 | . '(?:' // Unroll the loop: Consume everything until --> is found. |
| 211 | . '-(?!->)' // Dash not followed by end of comment. |
| 212 | . '[^\-]*+' // Consume non-dashes. |
| 213 | . ')*+' // Loop possessively. |
| 214 | . '(?:-->)?'; // End of comment. If not found, match all input. |
| 215 | |
217 | | '\[' // Find start of shortcode. |
218 | | . '[\/\[]?' // Shortcodes may begin with [/ or [[ |
219 | | . '[^\s\/\[\]]' // No whitespace before name. |
220 | | . '[^\[\]]*+' // Shortcodes do not contain other shortcodes. Possessive critical. |
221 | | . '\]' // Find end of shortcode. |
222 | | . '\]?'; // Shortcodes may end with ]] |
223 | | |
224 | | $regex = |
225 | | '/(' // Capture the entire match. |
226 | | . '<' // Find start of element. |
227 | | . '(?(?=!--)' // Is this a comment? |
228 | | . $comment_regex // Find end of comment. |
| 217 | '\[' // Find start of shortcode. |
| 218 | . '[\/\[]?' // Shortcodes may begin with [/ or [[ |
| 219 | . '[^\s\/\[\]]' // No whitespace before name. |
| 220 | . '[^\[\]]*+' // Shortcodes do not contain other shortcodes. Possessive critical. |
| 221 | . '\]' // Find end of shortcode. |
| 222 | . '\]?'; // Shortcodes may end with ]] |
| 223 | |
| 224 | $regex = |
| 225 | '/(' // Capture the entire match. |
| 226 | . '<' // Find start of element. |
| 227 | . '(?(?=!--)' // Is this a comment? |
| 228 | . $comment_regex // Find end of comment. |