Grafana Regex is not working as expected

Hell to all,

We are trying to get some data from Oracle tables, do some transformation using Regex, and display the output. Regex is working and find the data, but the output is not working. We are getting a date in format YYYYMMDD and would like to transform it as DD/MON/YYYY. We tested the Regex using Notepad++ Regex and it is working as expected, but it is not working on Grafana. Can someone help us with that?

Regex input
(\d{4})(?:(01)|(02)|(03)|(04)|(05)|(06)|(07)|(08)|(09)|(10)|(11)|(12))(\d{2})
Regex output
${14}/(?{2}Jan:?{3}Fev:?{4}Mar:?{5}Abr:?{6}May:?{7}Jun:?{8}Jul:?{9}Aug:?{10}Sep:?{11}Oct:?{12}Nov:?{13}Dec)/${1}

With respect and best regards

Hello,

I was looking into Grafana docs, and in this link regex | Grafana Loki documentation it says that Grafana Regex engine is based on “RE2” syntax and it seems this syntax did not support conditional operators.

Maybe we need to open a enhancement request in order to ask for Grafana developers start to use a more robust regex engine, in order to attend others requirements.

With respect and best regards

Hi @ancesar,

Welcome to the :grafana: community support forums !!

I was actually working on the timestamp conversion this week and found like you that either can use the Transformation function OR can also use Overwrite function.

If the Transformation did not help you then please have a look at this post where I created a small screencast on how to convert the timestamp into YYYY-MM-DD

For your other question regarding the REGEX, well I will be honest that I do not have that much expertise on this topic. But if you think this might be a bug as you already have done testing, then I can recommend opening this as an issue on our OSS GitHub repository at this link

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.