Strip special characters in emails

Hello

I have a requirement to clean e-mail ID on our source before having filled through. However, there is a particular scenario that I can't code to cut the special characters of the email before passing through a regular expression that checks for the validation of the email.

anyone would be able to tell me how I can do this using regexp. I guessing his regexp_replace but I don't know how to use it to escape occurrences only

ITH abc as

(' select ' [email protected]% $£ ' £$ %' as a double email )

Union of all the

Select ' [email protected] * ¬ @' as a double e-mail)

Select regexp_replace(email,'[[:punct:]]','') from abc

;

However, I do not want to replace all occurrences of @ or _ or. etc. which are part of a valid, only the finer e-mail id.

The above obviously just replaces all signs of punctuation as an approach to coverage that is false.

Seems you asked for zero or more


with abc as

(' select ' [email protected]% $£ ' £$ %' as email of all the double union)

Select ' [email protected]' as email of all the double union

Select ' [email protected]* ¬ @' as a double email

)

Select email, cleaned regexp_replace(email,'[[:punct:]]*$')

ABC

EMAIL CLEANED
" [email protected]% $£ ' £$ % [email protected]
[email protected] [email protected]
[email protected]* ¬ @. [email protected]

Concerning

Etbin

Tags: Database

Similar Questions

  • How to implement insert and put implement with special characters

    Hi all

    Scenario: I have a table and that is having e-mail column.

    condition:-my e-mail column should meet under the condition when the data is inserted.

    It should not allow any of the special characters ('@ ','.') and a ' @'.


    Thank you

    SQL> create table t
      2  (
      3    email varchar2(100) not null
      4  , constraint email_check check
      5                           (
      6                                 regexp_replace(email, '[@|.|[:alnum:]]') is null
      7                             and length(email) - length(replace(email, '@')) = 1
      8                           )
      9  );
    
    Table created.
    

    I used two conditions.

    1 regular expression to see if there is any character that is NOT @ or. or Digital Alpha.

    2 length check if @ is this several times.

    SQL> insert into t values ('[email protected]');
    
    1 row created.
    
    SQL> insert into t values ('karthick.p@@abcd.com');
    
    insert into t values ('karthick.p@@abcd.com')
    *
    ERROR at line 1:
    ORA-02290: check constraint (KARTHICK.EMAIL_CHECK) violated
    
    SQL> insert into t values ('[email protected]');
    
    insert into t values ('[email protected]')
    *
    ERROR at line 1:
    ORA-02290: check constraint (KARTHICK.EMAIL_CHECK) violated
    
  • Special characters escaped HOWTO if you use regexp_replace and regexp_substr

    Hello experts,

    following test case

    insert into querytest1 (d) values

    ("#1 (170): [{'type': 'FACEBOOK', 'count': 0, 'Larry': 1382627403299}, {'type': 'GOOGLE', 'count': 0, 'Larry': 1381825285002}, {'type': 'EMAIL', 'count': 2, 'Larry': 1381826322925}] #2(0): #3 (5):-3141 #4 (5):-3141 #5 (5): 21804 #6: (7) 3890750 #7(3): s11'");

    Select regexp_replace (d, REGEXP_SUBSTR (REGEXP_SUBSTR (d, ' [^] +', 1, 1), "[^:] +' 1, 2"), ") of querytest1;

    ERROR on line 1:

    ORA-12726: unparalleled support in regular expression

    evidence that the characters special [] {} are the problem:

    delete from querytest1;

    commit;

    -Insert data without special characters

    insert into querytest1 (d) values (' #1 (170): 'type': 'FACEBOOK', 'count': 0, 'Larry': 1382627403299, 'type': 'GOOGLE', 'count': 0, 'Larry': 1381825285002, 'type': 'EMAIL', 'count': 2, 'Larry' [: 1381826322925] #2(0): #3 (5):-3141 #4 (5):-3141 #5 (5): 21804 #6: (7) 3890750 #7(3): s11');

    Select regexp_replace (d, REGEXP_SUBSTR (REGEXP_SUBSTR (d, ' [^] +', 1, 1), "[^:] +' 1, 2"), ") of querytest1;

    REGEXP_REPLACE (D, REGEXP_SUBSTR (REGEXP_SUBSTR(D,'[^]+',1,1),'[^:] +', 1, 2), ")

    --------------------------------------------------------------------------------------------------------------------

    [#1 (170): 'FACEBOOK', 'count': 0, 'Larry': 1382627403299,: 'GOOGLE', 'count': 0, 'Larry': 1381825285002,: 'EMAIL', 'count': 2, 'Larry': 1381826322925,: 'EMAIL', 'count': 2, "Lamarre": 1381826322925] #2(0): #3 (5):-3141 #4 (5):-3141 #5 (5): 21804 #6: (7) 3890750 #7 (3): s11

    so now it works because there is no characters [special])

    is there a way to escape them?

    Thank you in advance.

    Hello

    Since you are using Oracle 11.2, you can do it with a WITH recursive clause, like this:

    MERGE INTO dst t

    WITH THE HELP OF)

    MORPHING (q, result, n_to_do, start_pos, end_pos) AS

    (

    Q SELECT

    ,       d || ' ' AS a result

    REGEXP_COUNT (q

    , '#\d+\(\d+\):'

    ) AS n_to_do

    REGEXP_INSTR (q,

    , '#\d+\(\d+\):'

    1

    REGEXP_COUNT (q

    , '#\d+\(\d+\):'

    )

    ) AS start_pos

    LENGTH (q) AS end_pos

    T

    UNION ALL

    Q SELECT

    REPLACE (result

    , ':' || n_to_do | ' '

    , NVL (RTRIM (REGEXP_SUBSTR (SUBSTR (q, 1, end_pos))))

    , '#\d+\(\d+\):(.*)'

    start_pos

    1

    NULL

    1

    )

    )

    , 'NULL '.

    )

    ) AS a result

    , n_to_do - 1 AS n_to_do

    REGEXP_INSTR (q,

    , '#\d+\(\d+\):'

    1

    BIGGER (1

    , n_to_do - 1

    )

    ) AS start_pos

    REGEXP_INSTR (q,

    , '#\d+\(\d+\):'

    1

    n_to_do

    ) - 1 AS end_pos

    MORPHING

    WHERE n_to_do > 0

    )

    Q SELECT, result

    MORPHING

    WHERE n_to_do = 0

    ) CBC

    WE (dst.q = src.q)

    WHEN MATCHED THEN UPDATE

    SET dst.result = src.result

    ;

    You can have any number of rows in table t, but they must have a unique key.  I assumed q was unique, highest, but it can be a column or combination of columns.

    It works with any number of values.

    The character "#" can occur in the values, just that it does not part of the point of shells #-figures-leftparen-figures-rightparen-colon. If "#" occurs in this model, you can't simplify regular expressions, as John.

    The above solution was written for the table that you posted in response #6, where q contained values, and d was the formula with the holders of the place for values.  You seem that overthrew in your last message, you may need to reverse I used q and d.

    Whatever your problem, it seems to be a way very uncomfortable to solve.  You need to rethink your data model.  In particular, stroring data in delimited as q lists are a bad idea.  Relational databases work best when when each column contains a single value, not a list of any number of values.  It is so basic to the design of database he called first normal form.

    This would help a lot if post you more simple examples.  Instead of having 7 values, some close to 200 characters, you could show the problem just as well (better, in fact) with 3 or 4 values, no tha 10 don't characters each.

  • Manages the entries of the user... of special characters and things

    I was wondering but in my case that I have to accept the entry of user in preparation for sending emails. APEX text box controls manage the entry so that any special characters or oracle commands are ignored so that they become plain text? If not, is there an easy way to handle this? In my case, I'm alittle concerned by the fact that I send the e-mail using PL/SQL, so he needs to not only check HTML but PL/SQL special characters special characters and escape characters in need.

    David,

    You're safe with just using a variable binding.

    See you soon,.

    Janet Tyson

  • Problem with Demo_Mail package sending an attachment and special characters

    Hello

    I did use the Demo_Mail package with the example in the http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html for many years on my 9i database.

    Recently, we have taken a form that depends on this package and quickly found that Asian characters were not correctly in the e-mail subject or body. When I changed the procedure by example, characters came through, however, attachments now appear in the body of the email as ascii.

    /*------------------------------------------------------start the email creation--------------------------------------------------------------------*/
    Conn: = demo_mail.begin_mail)
    sender = > from_name,.
    recipient = > to_name,.
    subject = > subject,.
    mime_type = > "text/plain; charset = utf8');

    () demo_mail.write_mb_text
    Conn = > conn,.
    message = > message | UTL_TCP. CRLF);

    If file1 is not null
    then
    () demo_mail2.begin_attachment
    Conn = > conn,.
    mime_type = > ' application/octet-stream. "
    Online = > FALSE,
    v_filename = > file1.
    transfer_enc = > 'base64');

    file_len: = dbms_lob.getlength (wire);
    modulo: = mod (file_len, TN);
    parts: = trunc(file_len / amt);


    / * (dbms_lob.read (wire, amt, filepos, buf); * /)


    While (counter < = pieces) LOOP

    DBMS_LOB. Read (wire, amt, filepos, buf);
    demo_mail.write_raw (conn, utl_encode.base64_encode (buf));
    filepos: = counter * TN + 1;
    counter: = counter + 1;

    END LOOP;

    / * Point on the rest of the data buffer * /.
    IF (modulo <>0) then
    DBMS_LOB. Read (wire, modulo, filepos, buf);
    demo_mail2.write_raw (conn, utl_encode.base64_encode (buf));
    end if;

    () demo_mail.end_attachment
    Conn = > conn);
    end if;

    () demo_mail.end_mail
    Conn = > conn);
    /*------------------------------------------------------end the email creation--------------------------------------------------------------------*/


    How can I have my cake and eat it too? Examples of scripts showing this scenario exist?

    In addition, even if I was able to get the body of the email to display special characters, the subject line still displays question marks instead of the special characters. I was never able to solve this problem.

    Any help to any of these questions is greatly appreciated!

    Thank you

    Kim

    You use the utl_encode.quoted_printable_encode before making all these changes? Most, if not all, of these accented characters must be converted to quoted printable form by the utl_encode.quoted_printable_encode function, then you only need to focus on the specific characters that must be encoded to the channel to cover additional expenditures for the mimeheader encoding. Specifically the white space characters should be encoded as well as the question mark.

    Also, I have done some minor testing and it seems that the quoted_printable_encode function folds the text when it exceeds a specific length. If I unfold the coded text object lines seem to come by fine. The folding text string is an equal sign followed by the sequence CRLF, unfold the text is a simple matter of these three characters. These changes becomes the encoding routine encapsulated in a function:

    create or replace function mimeheader_encode(
          p_str varchar2
        , p_charset varchar2 := 'UTF-8') return varchar2 is
      l_str varchar2(2000);
    begin
      l_str:=utl_raw.cast_to_varchar2(utl_encode.quoted_printable_encode(utl_raw.cast_to_raw(p_str)));
      l_str:=replace(l_str,'='||chr(13)||chr(10),''); --unfold the data
      l_str:=replace(l_str,'?','=3f'); --quote question marks
      l_str:=replace(l_str,' ','=20'); --quote spaces
      l_str:='=?'||p_charset||'?Q?'||l_str||'?='; -- add prefix and suffix
      return l_str;
    end;
    /
    
  • How to insert special characters when I hit e-mail or Facebook?

    How to insert special characters when I hit e-mail or Facebook?

    See also:

  • Web development Toolbox prevents me from using the letter upercase, special characters and all that requires the use of the SHIFT key. Help.

    whenever I press the SHIFT key, the web development Toolbox opens. I am unable to use the letter upercase, special characters and everything that requires the SHIFT key. It's really annoying me... i can't even use an exclamation mark111111

    The sounds you have a sticky key which is in the pressed state.

    Do you mean the box tools that should open via Ctrl + Shift + K or open more to the Toolbox that is displayed via Ctrl + F2?

    Try to press the keys involved several times, see the Web Developer menu for the shortcut keys.

    Have you tried to close and restart Firefox or restart the computer?

  • Where to find and install special characters in Firefox?

    Where to find and install special characters sets (French, German and Spanish) in my Firefox with Dutch language?
    TIA
    Joep

    Translation:

    TOOLS = > Options = > content = > languages = > click "Select" and then "select a language to add."

    For the character encoding:

    TOOLS = > Options = > content = > fonts and colors = > advanced (button) = > character encoding

  • How to enter special characters/symbols (i.e. the degree character) in the text boxes?

    Not a problem/w Firefox - I was wondering if there is a way to enter the special characters and characters (not on the keyboard) in the text boxes? I remember that there is a keyboard sequence that activates a context menu allowing the single character/symbol entry. Thanks in advance, Allan.

    See:

  • Special characters: Angle symbol

    Hi, I am trying to find the symbol 'angle' commonly used in mathematics (two lines forming an angle of 45 degrees, an acute 'L')

    The answer previous (linked) says to do the following

    -Edit

    -Special characters

    -Math (etc.)

    However, this is an old post and now this option seems unavailable.

    Seems to be replaced by 'Emoji and symbols' However the closest I can find in this list is "⎳".

    I sincerely hope that I have not only lack. Thank you

    Execution of Yosemite 10.10.3

    angle geometry symbol, can it be typed? Which character keyboard or the police?

    Emoji & symbols is just a new name for special characters.

    Did you click on the toothed wheel and customize and add mathematical symbols?  I see ∠ to U + 2220.

  • Problem of L50 - B satellite with special characters in country

    I recently bought the laptop SATELLITE L50 - B - 17 c and have a problem with special characters from countries in windows 7.

    In Polish, key key programmer combination right alt and the keys 'z', 'x', and 'c' should give the Polish special characters.

    Unfortunately this does not work for these three keys, however works other keys in Polish characters as 'l', 'n', 'a', a ' or 'e '. I suspect that this may be linked to the special key Fn,.

    However turning or disable in the BIOS did not help. Maybe there should be a driver of special keyboard for windows 7, but I have not found it :(

    {quote} I recently bought the laptop SATELLITE L50 - B - 17 c and have a problem with special characters from countries in windows 7. {quote}

    The laptop has been presintalled and configured with the Win 8.1 System.
    Have you noticed this problem with installation of Win 7 8.1 or after the victory?

    If you have an external USB keyboard, I recommend you to check if the same problem would appear using the USB keyboard. In case the external USB keyboard would work correctly, the problem could be related to a defective internal keyboard

  • Potential problem of keyboard - special characters

    Hello!

    I recently encountered a problem, and it is reproducible. When you type in Chrome on my Macbook Pro 13 inch Yosemite running, if I try to type a special character (for example, an 'e' with an accent), the keyboard becomes unresponsive. If I refresh the page, it still fails. The only way to make sensitive again is to close the browser and reopen it, but that does not make special characters work. Any ideas? I'm under 47.0.2526.111 (64 - bit) Chrome Version, if this is useful. Thank you!

    You have this problem with any app Apple, such as Safari, Mail, TextEdit, Pages, messages, Notes?

  • Special characters in the password

    Hi, I have chosen a password with caracter special: now @!
    and then, it is impossible to type the character @, so I can't start my machine!
    What can I do?

    Hello
    Sorry, but now you have a big problem. For the BIOS password or supervisor password, it should be used only the following characters: a... z, a.. Z and 0... 9 paper

    Choice of some special characters will cause that the laptop not boot not. In this case, contact your authorized Toshiba Service Provider because the password must be deleted and there is no way you can do it yourself.

  • Special characters and accents on the smart keyboard?

    How to type special characters and accents on the smart Pro iPad keyboard? For example, I like to write "Róisín Murphy" with accents in the name as shown here. But I can't find a way to do it. Are there not as a software keyboard that I can draw on screen for those?

    Thank you.

    If you have your English keyboard, then you can use the standard Mac shortcuts.  For acute, you more e option, then the basic letter.  e is more e, then e option.

    If you have your keyboard to something else, like Italian, then it might be different.  That your keyboard is set to?

  • where are the special characters in the new Pages?

    where are the special characters in the new Pages?

    Menubar pages: Edit: Emoji & symbols, or control-command + space combination. Same situation in other Apple applications. In addition, available as a menu item from the menu entry in the menu bar to the right, Finder.

Maybe you are looking for

  • Satellite P50T-B - speed WiFi problems

    So recently I bought this computer from future shop.It has the Intel Dual Band Wireless AC-3160 inside.I normally play with it, for example (LoL). Wifi works but the problem is that when I'm really close comes as 21 Mbps. But when I go upstairs to my

  • GetExternalModuleAddr library function error - 10 CVI 2010SP1

    Function GetExternalModuleAddr (certainly marked obsolete - but key to one of our older but much loved by the software plots) utility library fails with error code in 2010SP1 CVI (W7) The suggested alternative Win32 GetProcAddress API does not work w

  • missing runddl32.exe file?

    Hi, I recently had a virus that was deleted, but when he has deleted it - he took the file rundll32.exe with it and now when I double click on the desktop for example outlook, microsoft patch and other programs that it comes up with the box... open w

  • . Trojan:DOS / Alureon.A. MSE is unable to remove it. Is this a FIXIT for that?

    I have WINXP. MSE cannot remove the trojan(Trojan:DOS/Alureon.A) Is there a FIXIT MSE? If so, how it access? If this is not the case, WHAT can I do to remove it?

  • I have the Windows Vista (TM) Home Premium Service Pack 2 operating system

    My problem is, the operating system is already installed on my computer, but I do not have the disk? I have the key product etc.... How to make a copy of the operating system only?  So if my computer crashes and I can not load anything, I want to be