我有一系列这种格式的字符串:
Something_fromSomewhere
Something_fromSomewhere_ABC123
Something_fromSomewhere_DEF456
Something_fromSomewhereElse
Something_fromSomewhereElse_GHI123
我正在尝试像这样对它们进行分组...
Something_fromSomewhere
Something_fromSomewhere_ABC123
Something_fromSomewhere_DEF456
Something_fromSomewhereElse
Something_fromSomewhereElse_GHI123
所以我想挑选出包含这种模式的字符串:
^[Any1]_from[Any2]$
但我只想挑选Any2
不包含任何下划线的行。我怎样才能做到这一点?
(一旦我有了“根”元素,我就可以进行简单的字符串匹配来查找子元素。)