gpt4 book ai didi

.net - 字符之间的正则表达式 - 最后匹配

转载 作者:行者123 更新时间:2023-12-02 22:02:10 24 4
gpt4 key购买 nike

我正在搜索与最后一个 \_ 之间的值匹配的正则表达式

例子:

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

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

最佳答案

应该是

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

解释:

[^\\]*   # 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

关于.net - 字符之间的正则表达式 - 最后匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16759164/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com