-2
我使用\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;|]*[A-Z0-9+&@#/%=~_|]
來匹配這個字符串的URL(添加換行符爲了便於觀察;實際字符串是一個長期的事情):正則表達式匹配的URL
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
http://www.google.com Nullam id lacus turpis.
http://www.google.com?test=correct&only=1 Quisque ac posuere sem.
http://www.google.com/search?q=blah|george.
我現在正則表達式得到第2位。對於第三個它得到http://www.google.com/search?q=blah|george
。我如何在|
停止比賽?即,我希望它只匹配http://www.google.com/search?q=blah
。
我不知道該怎麼做...... –
......認真嗎?你只需點擊'|'字符的右邊,點擊Backspace,然後重複其他的。 –
刪除它:/(15個字符) –