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 CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by