Regex url的Crawler4j正则表达式模式

Regex url的Crawler4j正则表达式模式,regex,crawler4j,Regex,Crawler4j,我正在使用crawler4J,我只想对url创建一些模式,但我无法解决该url的正则表达式: http://www.site.com/liste/product_name_changable/productDetails.aspx?productId={id}&categoryId={category_id} 我尝试: liste\/*\/productDetails:aspx?productId=*&category_id=* 及 但它不起作用 我怎样才能使它成为正则表达式

我正在使用crawler4J,我只想对url创建一些模式,但我无法解决该url的正则表达式:

http://www.site.com/liste/product_name_changable/productDetails.aspx?productId={id}&categoryId={category_id}
我尝试:

liste\/*\/productDetails:aspx?productId=*&category_id=*

但它不起作用


我怎样才能使它成为正则表达式模式

您的正则表达式中有几个错误。所有星号都应为.+,以表示至少要匹配一个或多个字符。需要转义问号符号。类别id应为categoryId。productDetails:aspx应为productDetails.aspx。通过所有这些修复,正则表达式如下所示:

liste\/.+\/productDetails\.aspx\?productId=.+&categoryId=.+
此外,您不应该在正则表达式的开头和结尾使用^或$。这些匹配输入的开始和结束,因此如果您试图获取url的一部分,它们将不起作用

liste\/.+\/productDetails\.aspx\?productId=.+&categoryId=.+