我尝试使用Regex搜索下面的路径。
^.*Aurix_MC-ISAR[^mak]\/port.*但是它不起作用,所以我删除了表达式\/
^.*Aurix_MC-ISAR[^mak]port.* <-- It works well我的误解是什么?你能告诉我吗?
Target Path:D:\MCAL_SW_Test\MC-ISAR_AS4XX_AURIX_TC23X_AB_PB_BASE_V300\TC23x_ABstep\Aurix_MC-ISAR\port_infineon_tricore发布于 2016-04-24 14:35:36
这是你的雷吉斯
^.*Aurix_MC-ISAR[^mak]\/port.*它对你的弦的分解表明
^ #Start the string
.* #Consume everything till next string is found
Aurix_MC-ISAR #Find this string literally
[^mak] #Match anything except m, a or k (In your string Aurix_MC-ISAR, what follows just after it is \ which is neither m, a or k. So successful match)
\/ #Now there is no / in your string further. So it fails here
port.* #Whatever here it won't match as it already failed请参阅这里
注意到 :-据我所知,您在输入时使用\。因此,为了转义\,您需要使用\\而不是转义/的\/。尽管它不会对您的输出产生任何影响,因为在\之后没有任何额外的Aurix_MC-ISAR\
发布于 2016-04-24 14:47:06
当然,这是会发生的。[^mak]的意思是一个不是 m、a或k的字符。它与\/匹配,因此[^mak]\/是冗余。
而且,在看到您的路径之后,应该是\\ 而不是 of \/。
https://stackoverflow.com/questions/36824289
复制相似问题