我想在 url 中找到一个带有记事本++正则表达式的字符串。不幸的是,我不能。
http://www.example.com/profile/mera-handelsgesellschaft-mbh-182055?category_id=154331
我想要的是182055
我只会找到它。不改变。
我最后一次尝试是([^-|^=])(d+)([^?])
我怎样才能找到它
请尝试这个正则表达式:
d+(?=?)
d
查找数字
d+
查找一个或多个数字
(?=?)
是一个积极的展望。这意味着选择一个或多个数字,这些数字后面有一个?
字符。
从正则表达式101:
d+ match a digit [0-9] Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy] (?=?) Positive Lookahead - Assert that the regex below can be matched ? matches the character ? literally
正则表达式 101 演示