regex - keyword="value" regular expression -
my regular look
(?<keyword>\w+)\s*=\s*\"(?<value>\w+)\"
is not right match keyword, value pair in my
oauth_version="1.0", oauth_signature_method="hmac-sha1", oauth_nonce="k7wmp9yrr2ocyc3", oauth_timestamp="1413801976", oauth_consumer_key="test", oauth_signature="8ad2fzh23q%2fwfk6rykqcvhllxh4%3d"
because utilize \w match 3 groups. need match .%- know should use?
use negated character class [^\"]
instead of \w+
match character nof of "
1 or more times.
(?<keyword>\w+)\s*=\s*\"(?<value>[^\"]+)\"
demo
regex
No comments:
Post a Comment