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

 Akzeptierte Antwort

madhan ravi
madhan ravi am 18 Jul. 2019
Bearbeitet: madhan ravi am 18 Jul. 2019

0 Stimmen

v = regexp(cell_array,'(HQ)\d+','match');
Wanted = [v{:}]

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018b

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by