linux - grep正则表达式如何进行最短匹配?
迷茫
迷茫 2017-04-17 14:47:29
0
3
669
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
大家讲道理

This can be matched grep -o "ed2k[^"]*"

[root@localhost oldlog.md]# echo '你的地址' | grep -o "ed2k[^\"]*"
ed2k://|file|%E7%A1%85%E8%B0%B7.Silicon.Valley.S01E01.%E4%B8%AD%E8%8B%B1%E5%AD%97%E5%B9%95.HDTVrip.1024X576.mkv|348759100|04dc44e4978ea2d4dc9bf41b08829a3e|h=rfe5smulijxlmz7mgtpmn2bt3vmofk56|/
ed2k://|file|silicon.valley.s01e01.720p.hdtv.x264-killers.mkv|843706966|3B4B08BD9C960B5B8F2372158F84B1AE|h=36632AROF43T63NSXFLIGSYEB4PNDEFN|/
Ty80

It is recommended to use some HTML parser to extract the a tag separately for matching, which can avoid the problem of multiple a's in one line

迷茫

By default grep doesn't support non-greedy modifiers, but you can use grep -P to use the Perl syntax.

How to do a non-greedy match in grep?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!