arrays - Get word from string - PHP -
i trying extract word matches specific pattern various strings.
the strings vary in length , content.
for example:
i want extract word begins jac following strings , populate array full words:
- i bought jacket yesterday.
- jack going home.
- i want go jacksonville.
the resulting array should [jacket,jack,jacksonville]
i have been trying use preg_match() reason won't work. suggestions???
$q = "jac"; $str = "jacket"; preg_match($q,$str,$matches); print $matches[1]; this returns null :s. dunno problem is.
Comments
Post a Comment