I have a str that looks like this:
str = '7-6-1'
and I would like to return 6.
I was able to return 7 using ^[^-]*[^ -] but can't seem to find the expression to return the second item.

 채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 23일

0 개 추천

(?<=-)\d(?=-)
Is one of the ways.
(?-)\d(?-)
might work

추가 답변 (0개)

카테고리

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

질문:

2019년 10월 23일

답변:

2019년 10월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by