【发布时间】:2021-08-01 03:01:17
【问题描述】:
这是我的问题:
我有一个类似的字符串列表:
1) mytext-othertext-01-Onemore
2) mytext1-othertext1-02-Twomore
3) mytext2-othertext2-03-Fourmore
4) ...
我试图在我的文本中获得 ONLY 第三个 "-" 之后的 FIRST 字符,因此结果将是:
1) O => because mytext-othertext-01-Onemore
2) T => because mytext1-othertext1-02-Twomore
3) F => because mytext2-othertext2-03-Fourmore
我在使用正则表达式时非常糟糕,我认为这可能不是一个难点,但我现在被困住了:
\-(.*)
如您所见,这将占用第一个“-”之后的整个文本
帮助解决我的问题将不胜感激。
【问题讨论】: