一直试图找出这一点,没有得到太多的成功。我想知道是否有人可以帮忙。正则表达式(蟒蛇)捕获参数积极lookahead
我有一系列潜在的字符串,下面是来源。基本上,我试图从参数中检索某个值(假设my_param
);但它可能在string
的开头,string
的中间或string
的末尾。
如何生成python
regex
以捕获所有情况下的此情况?
这是我到目前为止有:((&_csrf)|(_csrf))=(.*)(?=&)
的问题是,如果它是在string
结束返回没有匹配或者有多个parameters
那么它在未来parameter
肿块。
任何人都可以帮忙吗?
谢谢!
源串1:
my_param=stuffinhereIwant&some_other_param=Idontcareaboutthis&some_param2=Don'tWantThisEither
源串2:
some_param=Idontcareaboutthis&my_param=stuffinhereIwant&some_param2=Don'tWantThisEither
源串3:
some_param=Idontcareaboutthis&some_param2=Don'tWantThisEither&my_param=stuffinhereIwant
源串4:
my_param=stuffhereIwant
您的字符串是否总是被'my_param ='预置?如果不是,请更好地澄清您的匹配规则。 – zwer