Try this again, using a lookahead operator to create the following AND condition:
(lowercase letter) AND (not a vowel)
This time, the result is correct:
c = regexp(chr,'(?=[a-z])[^aeiou]','match')
c =
1×13 cell array
{'s'}
{'t'}
{'m'}
{'t'}
{'t'}
{'h'}
{'m'}
{'t'}
{'r'}
{'x'}
{'n
Note that when using a lookahead operator to perform an AND, you need to place the match
expression expr after the test expression test:
(?=test)expr or (?!test)expr
See Also
regexp | regexpi | regexprep
More About
•
“Regular Expressions” on page 2-51
Lookahead Assertions in Regular Expressions
2-65
Précédent

- 115/1450

Suivant