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 ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by