How to search for characters that must match the end of the string with preg_match in PHP

1 Answer

0 votes
// We need a dollar sign ($) at the end of a regular expression
 
preg_match("/Profession$/", "Information, Tools & Social For Your Profession"); // return true (1)
preg_match("/Profession$/", "For Your Profession Tools, Information & Social "); // return false (0)
// It's Case-sensitive
preg_match("/profession$/", "Information, Tools & Social For Your Profession"); // return false (0)


answered May 9, 2014 by avibootz
edited May 9, 2014 by avibootz
...