Split string by number and character in php -
i've seen question problem unfortunatly cant find solution.
i have below string
$s = "ab2|5ac114|25ad" i want below result. array has 3 member
{"ab","ac","ad"}
using php's preg_match_all() method can filter out lower case alphabetical characters [a-z] pattern. quantifier + means number between one , unlimited. if looking 2 lowercase characters, can replace more specific quantifier {2} pattern "/[a-z]{2}/"
<?php $subject = 'ab2|5ac114|25ad'; preg_match_all("/[a-z]+/", $subject, $matches); $result = $matches[0]; print_r($result);
Comments
Post a Comment