'request='
との間の文字列の正規表現を教えてください'">'
。
たとえば、request=this_is_the_text_I_need">
正規表現の場合は が返され'this_is_the_text_I_need'
ます。
'request='
との間の文字列の正規表現を教えてください'">'
。
たとえば、request=this_is_the_text_I_need">
正規表現の場合は が返され'this_is_the_text_I_need'
ます。
This should work: request=(.+?)">
. It will extract any text which is between request=
and ">
. It should allow you to access the value through the use of regex groups.
Note: I am assuming that you are using the single quotes to denote the answer you are after, and do not want them as part of the returned value.
あなたが探しているのは、先読みと後読みのステートメントです。たとえば、grep
:
$> echo 'request=this_is_the_text_I_need">' | grep --only-matching --perl-regex "(?<=request=).*(?=\">)"
this_is_the_text_I_need
したがって(?<=request=).*(?=\">)
、3つの部分で構成されます。
(?<=request=)
-一致した文字列が。の後にあることを示しますrequest=
。.*
-一致した文字列にすべての可能な記号が含まれる可能性があることを示します(?=\">)
-一致した文字列がの前にあることを示します">
。