1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Regex to identify all "special" characters

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 4, 2024 às 22:42.

  1. Stack

    Stack Membro Participativo

    I have a table, sales, with a column, email_address. I want to filter to only include records in the sales table that have any characters that are neither alphanumeric nor special characters. These include A-Z (lower/upper), characters with accents and tildes, 0-9, and the following:

    `~!@#$%^&*()_-+={}[]|\:";'<>,.?/


    Right now, I am using the following:

    select *
    from db.sales
    where email_address !~ '^[.a-zA-Z0-9!@#$%^&*()_\+={}\[\]|\\;:\"<>\,\./?\-]'
    AND email_addr !~ '[[alphanum]]'


    Unfortunately, entries like these are getting picked up:

    • <testemail123@email.me
    • 'email@email.com
    • ábc@123.com

    I'm trying to figure out, how do I remove those fields which have "standard" characters, and only filter for those with "non-standard" characters (e.g., emojis, mathematical symbols)?

    Continue reading...

Compartilhe esta Página