Hi Jason,

Prometheus uses the RE2 regular expression dialect, you can find the
documentation about that here: https://github.com/google/re2/wiki/Syntax

The double backslash ("\\") is just to escape the one backslash in the
Prometheus string. So the actual regex is just "5\\d{2}". You can remove
the escaping by using backticks as quotes, which do not interpret escape
sequences: `5\d{2}`

Kind regards,
Julius

On Tue, Oct 3, 2023 at 12:03 PM 'Jason' via Prometheus Users <
prometheus-users@googlegroups.com> wrote:

> On 03.10.2023 10:55, Stuart Clark wrote:
> > In reality both will do the same thing, although the second is
> > technically more correct.
> >
> > The first regular expression is matching "5" followed by 1 or more other
> > characters, while the second is matching "5" followed by exactly 2
> > numbers. So the first one would also match "50" or "5frogs" which aren't
> > valid status codes, but in reality your application would have to be
> > having serious problems to be setting those values anyway.
>
> Thanks Stuart
>
> Is there any docs about this type of regex? I didn't found "\\d" in
> official docs.
>
> How is this regex called?
>
> cheers
> Jason
>
> --
> 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 prometheus-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/988b8358-d588-4120-8768-d8c7f29fe8f5%407748229.xyz
> .
>


-- 
Julius Volz
PromLabs - promlabs.com

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAObpH5zXYjub7zdx%2BrxkGDqf9AajatS-jEzjkGqJ-9Wd7cQPOA%40mail.gmail.com.

Reply via email to