Regex Email in Elastic Search


(Mohammadhadi Sankar) #1

Hi Every Body
I have a Text field
it have a lot of text . I want to extract Email Address from this text.
how can extract Email Address using Regex in Elastic Search?


(David Pilato) #2

What for? I mean you want to extract that to a field?

You can use an ingest pipeline probably for that.
Also have a look at ingest nlp project which tries to automatically recognize emails and other entities.


(Mohammadhadi Sankar) #3

if i want to user Regex how can solve it?


(David Pilato) #4

I don't understand the question. May be explain with an example?


(Mohammadhadi Sankar) #5

for example:
i have a field its name is body
its have some records contains email address
i want to select records include email. how can select with Regex in ES?


(David Pilato) #6

Probably something I'd avoid doing though: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html


(Mohammadhadi Sankar) #7

yes - i create a regex with your link
this is my regex : " [a-zA-Z]+@[a-zA-Z]+.[a-zA-Z]+ "
is it work but it have a problem
for example : @aaaa match with this regex
but your link says its not match.
give me a regex for elasticsearch that i match with test@gmail.com and not matched with @gmail.com


(David Pilato) #8

I don't know. I'm not good at writing regex.


(system) #9

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