How to select strings using regexp?

1 次查看(过去 30 天)
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

采纳的回答

madhan ravi
madhan ravi 2019-7-18
编辑:madhan ravi 2019-7-18
v = regexp(cell_array,'(HQ)\d+','match');
Wanted = [v{:}]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by