what is the problem with this regex?
PUBLIC_API_REQUEST:http://localhost:6501/public/api/v1/getBranches/client/faraApp {some text
here} PUBLIC_API_RESPONSE:{some text here}
myregex :PUBLIC_API_REQUEST:(?<address>(?:[A-z\:\-\0-9\/]+)) (?<requestBody>[^}]*)
PUBLIC_API_RESPONSE:(?<response>[^}]*)
You need to match and consume the text that you are not going to capture, like {
or {
chars.
Also, the [A-z]
is not matching just letters, it is simpler and less confusing to use %{NOTSPACE:address}
(matching a streak of non-whitespace chars) instead of (?<address>(?:[A-z\:\-\0-9\/]+))
.
You can use
PUBLIC_API_REQUEST:%{NOTSPACE:address} +\{(?<requestBody>[^{}]*)} +PUBLIC_API_RESPONSE:\{(?<response>[^{}]*)}
Test screenshot: