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"} 

seen link 1 link 3

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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -