2

lastの間の値に一致する正規表現を探しています\_

例:

入力:\\\ezbe.local\folder1\folder2\folder3\33248a-48596-a54qsd-4d7d98_2

出力:33248a-48596-a54qsd-4d7d98

4

1 に答える 1

5

それは

[^\\]*(?=_[^\\]*$)

説明:

[^\\]*   # Match any number of non-backslash characters
(?=      # if the following is true after the matched text:
 _       # There is a _
 [^\\]*  # followed only by non-backslash characters
 $       # until the end of the string.
)        # End of lookahead assertion
于 2013-05-26T12:22:56.327 に答える