I want to write a regular expression, it should match a string after '?' and end with '#'.
我想写一个正则表达式,它应该在'?'之后匹配一个字符串并以'#'结尾。
Simple Input: somegarbage?Hello,world#garbage
简单输入:somegarbage?Hello,world#garbage
Simple Output: Hello,world#
简单输出:你好,世界#
2 个解决方案
#1
3
(?<=\?).*#
(?<=\?)
means starting with a ?
but not including it.
(?<= \?)表示以?开头?但不包括它。
#2
0
with info currently given, thw following should work
目前给出的信息,以下应该工作
.*\?(.*#).*
the group contains the value in question
该组包含有问题的值
#1
3
(?<=\?).*#
(?<=\?)
means starting with a ?
but not including it.
(?<= \?)表示以?开头?但不包括它。
#2
0
with info currently given, thw following should work
目前给出的信息,以下应该工作
.*\?(.*#).*
the group contains the value in question
该组包含有问题的值