2014-10-27 29 views
-1

如何使用正則表達式從以下URL中選擇所有字符(最大爲2)?正則表達式來選擇一個URL中的特定字符

http://localhost/web/gifts/index.php?catalogue=tshirts&page=2 
http://localhost/web/gifts/?page=2 

http://localhost/web/gifts/?page= 
http://localhost/web/gifts/index.php?catalogue=tshirts&page= 

我想改變頁面數量時翻頁按鈕或任何其他頁面點擊

回答

1
(.*)(?=\b\d+$) 

這應該做it.See demo.Grab的cpature。

http://regex101.com/r/sU3fA2/17

+0

如果有任何數字,該怎麼辦? – sAs59 2014-10-27 11:37:22

+0

@ sAs59'(。*)(?= \ d + $)' – vks 2014-10-27 11:40:32

+0

我試過了,但它不起作用 – sAs59 2014-10-27 11:41:56

相關問題