Sorry, just noticed that the regex and the sample response message I posted do not have the same identifier i.e. 123456 vs 465251
This isn't the issue, the number in the regex matches the response message I'm getting. On Saturday, 7 March 2020 16:38:13 UTC, TommyG wrote: > > Hi folks > > New to Prometheus but liking it so far. > > I'm trying to use the blackbox exporter to test an API. I want to check > the contents of the response body but I'm having trouble with regex that > may or may not be related to escaping the | character. > > I'm sending in HL7 messages and getting a HL7 response, they make > extensive use of the pipe character. > > My blackbox.yaml > > Enter code here... http_post_json: > prober: http > timeout: 5s > http: > method: POST > preferred_ip_protocol: "ip4" > headers: > Content-Type: application/json > body: "MSH|^~\\ > &|TEST|TEST|TEST|TEST|20200102101206||ADT^A31|123456|P|2.4\......" # full > message removed for clarity > fail_if_body_not_matches_regexp: > - .*MSA|AA|123456$ > > The response looks like this > > MSH|^~\&|EMS|RA9|PAS|RA9|20200307152450.723+0000||ACK^A31|3352|P|2.4 > MSA|AA|465251 > > I'm only interested in the last line, specifically MSA|AA|123456 > > My problem is that this regex passes (which is fine) but if I change the > |AA| to |AE| i.e. > fail_if_body_not_matches_regexp: > - .*MSA|AE|123456$ > > A successful response i.e. one ending MSA|AA|123456 still passes???? > > I've tried escaping the | characters i.e. > Enter code here... fail_if_body_not_matches_regexp: > - .*MSA\|AA\|123456$ > > But then all messages fail. > > I've tried various combinations of using double and single quotes but > haven't had any success. > > Any help much appreciated > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/096aeba9-453f-481f-ad33-2d1e2610b354%40googlegroups.com.

