[英]javascript regex exclude dot
Hello I'm finding difficulties making the right regex.您好,我在制作正确的正则表达式时遇到了困难。 I'm missing something, but I don't know what.
我错过了一些东西,但我不知道是什么。
pattern:图案:
href=".*?\/FileBrowser\/File\?path=esoft\/[^.\s]*?"
test string:测试字符串:
dfhgndfhkljh;fth href="/FileBrowser/File?path=esoft/test/I4/I0000/as.jpeg" dfghfdhnjfgh e:small;"><a href="/FileBrowser/File?path=esoft/test/bb/2evo/1_folder" target="_blank"dsadsadsa
and the site I use to test online is https://regex101.com/r/mU5vH6/2我用来在线测试的网站是https://regex101.com/r/mU5vH6/2
The goal is to mark the links (after the href) separately as shown https://regex101.com/r/mU5vH6/3 here, but if one of them has a dot - meaning file path, not to be included目标是单独标记链接(在 href 之后),如https://regex101.com/r/mU5vH6/3此处所示,但如果其中之一有一个点 - 表示文件路径,则不包括在内
You can use this regex:您可以使用此正则表达式:
href="[^"]*\/FileBrowser\/File\?path=esoft([^.])*?"
The previous one was matching:上一个是匹配的:
dfhgndfhkljh;fth href="/FileBrowser/File?path=esoft/test/I4/I0000/as.jpeg" dfghfdhnjfgh e:small;"><a href="/FileBrowser/File?path=esoft/test/bb/2evo/1_folder" target="_blank"dsadsadsa
|___________________________________________________________________________________________________________________________________________|
Because you allowed your match to contain "
, which consumed too much chars因为你允许你的比赛包含
"
,这消耗了太多的字符
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.