Wednesday 15 April 2015

php - all strings of upper case with preg_match_all -



php - all strings of upper case with preg_match_all -

this quick resolution more adept @ regular expressions myself, trying take line of linguistic gloss (like this:)

e q that.thing.in when exist loc?

and pull out parts exclusively in upper case , set them array. i've gotten far using:

preg_match_all("|[a-z]|u",$text,$glosses,preg_pattern_order);

but makes array like:

e, q, i, n, l, o, c

and need is:

e, q, in, loc

can help? :)

thanks lot!

use world boundary metasequance \b determine words such

the regex be

\b[a-z]+\b

ensures regex bound word boundary \b @ both ends of uppercase word

preg_match_all("\b[a-z]+\b",$text,$glosses,preg_pattern_order);

would give output as

e, q, in, loc

php regex preg-match-all

No comments:

Post a Comment