[Maria-discuss] Remove everything except email addresses in from_addr table in mariaDB
Hi list,
I am running MariaDB Server version: 10.4.17-MariaDB in Cent OS7.
I have a column called from_addr from table msgs.
Plz see its OUTPUT.
select from_addr from msgs;
+----------------------------------------------------------------+ | from_addr | +----------------------------------------------------------------+ | admin@sender.com | | userl@mysys.net | | Firstname Lastname user622@yahoo.com | | userl@mysys.net | | Firstname Lastname user75@gmail.com | | root@domain.net (root) | | userl@mysys.net | | userl@mysys.net | | Firstname Lastname user75@gmail.com | | userl@mysys.net | +--------------------------------------------------------------+
When Users send mails this from_addr column fills. some times with just email addresses, Some times email address with Display names.
What I expect is to remove all the display name part. I only need email addresses.
I expect from_addr column in this way.
+--------------------------------------------+ | from_addr | +--------------------------------------------+ | admin@sender.com | | userl@mysys.net | | user622@yahoo.com | | userl@mysys.net | | user75@gmail.com | | root@domain.net | | userl@mysys.net | | userl@mysys.net | | user75@gmail.com | | userl@mysys.net | +--------------------------------------------+
How can I solve it. I tried a lot. But, I could NOT get what I expect. finally I subscribed to mariaDB mailing list.
I need your INPUTS.
On Friday 27 November 2020 at 13:12:44, Indunil Jayasooriya wrote:
+----------------------------------------------------------------+ | from_addr | +----------------------------------------------------------------+ | admin@sender.com | | userl@mysys.net | | Firstname Lastname user622@yahoo.com | | userl@mysys.net | | Firstname Lastname user75@gmail.com | | root@domain.net (root) | | userl@mysys.net | | userl@mysys.net | | Firstname Lastname user75@gmail.com | | userl@mysys.net | +--------------------------------------------------------------+
When Users send mails this from_addr column fills. some times with just email addresses, Some times email address with Display names.
What I expect is to remove all the display name part. I only need email addresses.
I would look at whatever process is putting this information IN to MariaDB - it seems that you are not parsing the address sufficiently to pick out just the part enclosed within < >
Given that you are accepting Internet-supplied input and simply feeding it in to a MariaDB table like this, I would strongly advise you also to consider input sanitisation to ensure that someone doesn't claim that their lastname is, for example "; drop table msgs" in the hope that your input parser simply passes this through as part of a SQL statement...
Regards,
Antony.
participants (2)
-
Antony Stone
-
Indunil Jayasooriya