How to select strings using regexp?

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

 Respuesta aceptada

madhan ravi
madhan ravi el 18 de Jul. de 2019
Editada: madhan ravi el 18 de Jul. de 2019
v = regexp(cell_array,'(HQ)\d+','match');
Wanted = [v{:}]

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 18 de Jul. de 2019

Editada:

el 18 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by