Performing a regex search in Kibana dev tools


(gearoid houston) #1

Hi,

I am trying to perform a regex search in dev tools within kibana.

Current query:

GET test/_search
{
"query": {
"regexp":{
"BATAPSN": ".BDT[0-9]{4}."
}
}
}

I want the query to identify BDT, followed by 4 numbers, e.g. BDT1234 in the BATAPSN field.

The query is returning results such as BDT12345 which is not desired.

How can I fix this issue.

Thanks


(CJ Cenizal) #2

Hi Gearoid,

It looks like you have periods at the beginning and ending of your regex: .BDT[0-9]{4}. -- is this intentional? If so, what is the role they're supposed to play? I believe the ending period is what's causing this regex to match BDT12345, because it indicates that any character is acceptable following the [0-9]{4} match. The 1234 section matches that part of the pattern and then the ending 5 is matched by the period. Does this help?

Thanks,
CJ


(system) #3

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