How to select strings using regexp?

2 vues (au cours des 30 derniers jours)
Peter Valent
Peter Valent le 18 Juil 2019
Modifié(e) : madhan ravi le 18 Juil 2019
I have a cell array with strings. I need to select only those cells which strings start with "HQ" and follow with a number.
Example of accepted strings: 'HQ30', 'HQ100', 'HQ1000'
Example of unaccepted strings: 'ABC50', 'HQLB30', 'UBHQ100' and similar.
I want to do it using regular expresions.
Thanks

Réponse acceptée

madhan ravi
madhan ravi le 18 Juil 2019
Modifié(e) : madhan ravi le 18 Juil 2019
v = regexp(cell_array,'(HQ)\d+','match');
Wanted = [v{:}]

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Produits


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by