How to select strings using regexp?

1 回表示 (過去 30 日間)
Peter Valent
Peter Valent 2019 年 7 月 18 日
編集済み: madhan ravi 2019 年 7 月 18 日
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 Center および File ExchangeString Parsing についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by