Why is this PHP regular expression returning 1?

Why the following regular function call returns the value 1 :

 preg_match('<strong>', '<strong[\>\s]+') 

According to the documentation , I would think that they need to be canceled.

+4
source share
1 answer

<strong> is a regular expression with angle brackets as delimiters . The actual regex is only part of strong , which successfully matches the subject line, as it has no ^ and $ bindings.

This will fail:

 preg_match('/<strong>/', '<strong[\>\s]+') 
+6
source

All Articles