perl 获取匹配正则表达式字串

2016-07-18 11:01:17来源:oschina作者:洪兴山鸡人点击

perl-lne'print$1if/(&url=.*html)/'verylongline.txt

perl 处理起来相当的方便,如果是awk 的话,写起来要复杂一些。


实现目标:有一个很长的文本,希望将里面符合目标模式的文本抽出来


verylongline is like the following "


/pl/?ac=init&ver=2.0&p1=0&p2=14&ty=0&uid=-&lc=04a04532ee629ce3b04fef39f9ba5753&uuid=1931280229652598&cid=4&pid=10010858&vid=24036535&lid=10010858&st=&sid=&vlen=221&ch=lesports&url=http%3A%2F%2Fsports.dnsname.com%2Fvideo%2F24029774.html&weid=514479312471469006074667&ref=http%3A%2F%2Fwww.letv.com%2F&pv=3.4.0&ilu=1&r=0.20196354296058416&pt=-&err=0&ut=-&ry=0&vt=-/pl/?ac=block&ver=2.0&p1=0&p2=14&ty=0&uid=-&lc=1724d969c14d2842dcbeb8fca09cb7e6&uuid=1933483847923905_1&cid=4&pid=10013491&vid=24034759&lid=10013491&st=&sid=&vlen=55&ch=lesports&url=http%3A%2F%2Fsports.dnsname.com%2Fvideo%2F24034759.html&weid=514479334830273255928159&ref=-&pv=3.4.0&ilu=1&r=0.1325086944270879&pt=-&err=0&ut=1524&ry=0&vt=21


"


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台