Hi,
I've some example strings:
CS-TZ24SKEW --> 24
CU-V18RKH-1 --> 18
CS-S24RKH-1 --> 24
CS-XC9RKD-3 --> 9
RS-PS9QK --> 9
CU-V18RWA --> 18
CS-KC18QKH-8 --> 18
CU-QA18RKH-8 --> 18
All I want to do is to extract the numeric values as shown on the right side of the respective strings. Is this possible with a couple of lines of code?
Thanks in advance.

 채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 4일

2 개 추천

S = {'CS-TZ24SKEW', 'CU-V18RKH-1'};
extracted = regexprep(S, '^(\D+)(\d+)(.*)', '$2');

추가 답변 (1개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

질문:

2016년 4월 4일

댓글:

2016년 4월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by