Regular expression doesnt work in Kibana Search panel

Hi All

As we have a search panel in Kibana Discovery tab, i want to search Phone Number

In my current dataset I have certain Phone Number which is not numeric, i want to sort out which are non-numeric

For this I am using this regular expression in search panel

PHONE : [0-9]\ this is for numeric
PHONE : ^[0-9] this is for non-numeric

Please let me know if we can run regular expressions in Kibana Search panel

As documented, regular expressions should be surrounded by forward slashes. Also, your regular expressions don't make sense. The first one isn't a valid regexp (it can't end with a backslash) and the first one matches field values that begin with a literal ^ followed but a digit. If you want to check if a field value only contains digits you should be able to use phone:/^\d+$/ and you to match everything else you can say either NOT phone:/^\d+$/ or phone:/\D/.

Hi

It was my mistake, i was using this

PHONE : /[0-9]/ this is for numeric
PHONE : /^[0-9]/ this is for non-numeric

I do not see anything for "d" in Regular Expression. What does "d" signifies for

\d means digit in most regular expression variants. Maybe not Lucene's though—replace with [0-9] in that case.

Again, I can't make specific comments about your expressions since I don't know what you want to match, but ^[0-9] still doesn't make sense. If you want to match non-digits you need [^0-9].

1 Like