Regexp Find Digit between two hyphens

조회 수: 8 (최근 30일)
Mark Krzysztopik
Mark Krzysztopik 2019년 10월 23일
답변: Walter Roberson 2019년 10월 23일
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일
(?<=-)\d(?=-)
Is one of the ways.
(?-)\d(?-)
might work

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by