我需要一个正则表达式来获取<%=this.Title%>
,但如果它以//
开头,它就什么都不做。
示例:
http://
需要抓住:
// blabalbal line
// catch'm all line(从“// catch”开始)
//这是一个链接(以“// this”开头)。
我尝试使用以下变体:'<?php
function lol(){
// blabalbal
} // catch'm all
echo 'http://link.com.br'; // this is a link.
'
答案 0 :(得分:1)
你可以使用php支持的负面lookbehind。
//
如果前面没有http:
,则只会与:
匹配。根据您的需要,您可能只能router.js
离开。
答案 1 :(得分:0)
您可以在此处使用:
[^http:](//.*)
丢弃http
字符串,仅捕获以//