Saturday, 15 August 2015

regex - Why does this PHP regular expression return 1? -



regex - Why does this PHP regular expression return 1? -

why next regular function phone call homecoming value of 1:

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

according documentation, have thought ought reversed.

<strong> regular look angle brackets delimiters. actual regex strong part, matches against subject string since has no ^ , $ anchors.

this fail:

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

php regex

No comments:

Post a Comment