Replace multiple characters to unique character

Hi friends,

I would replace several characters of a string to a single character. The character may be a vertical bar (|) or a tilde (~).

For example ' |. ' ASDF | 123 | XYZ | "should be replaced by" asdf ". 123 | XYZ ".

I use Oracle 11 g 2.

Thanks in advance!

Without regexp

with testdata until)
Select ' | ASDF | 123 | xyz |'union str double all the
Select ' asdf | 123 | XYZ | "of all the double union
Select ' | ASDF | 123 | XYZ | "double
)

Select
trim (both ' |' to)
replace)
replace)
Replace (str,'|) «, » |'|| Chr (0))
, chr (0) |' | '
)
, chr (0)
)
) str
of testdata

STR

"asdf". 123 | XYZ ".

"asdf". 123 | XYZ ".

"asdf". 123 | XYZ ".

with regexp

with testdata until)
Select ' | ASDF | 123 | xyz |'union str double all the
Select ' asdf | 123 | XYZ | "of all the double union
Select ' | ASDF | 123 | XYZ | "double
)

Select
trim (both ' |' to)
regexp_replace)
Str
,'\|+'
,'|'
)
) str
of testdata

STR

"asdf". 123 | XYZ ".

"asdf". 123 | XYZ ".

"asdf". 123 | XYZ ".

Post edited by: regexp added chris227

Tags: Database

Similar Questions

  • replace multiple characters using regexp_replace

    Hello
    I want to replace several characters using regexp_replace as

    regexp_replace (' # 30 Street/one home pc.) CA «, » #/. «, » NO -,')

    Help, please

    Kind regards

    Hello

    Try this

    select translate(replace(:ipstr,'#','#~'),'#~/.','NO-,')from dual
    
  • Replace special characters

    Hello

    I need SQL or PL/SQL code to replace special characters such as!, @, #, $, %, ^ of the given string.

    For example, if the given string is

    "it is - test * strin #g to @ spe % ial charact!" ERS"he should replace all special characters and provide the output voltage

    It's test string with special characters

    Please enter the code

    Thank you

    You have commas in the character set block and the [[: alnum:]] is equivalent to [a-zA-Z0-9], you may want to include a space in this updated chacter block.

    Select REGEXP_REPLACE ("This is test * strin #g to @ spe % ial charact!") ERS ',' [^ [: alnum:]] *', ")

    of the double

    Output

    It's test string with blue characters

    EDIT: I do not know what will want the characters allow the OP. For example, a comma, question mark, comma, colon, apostrophe, full stop etc. are all valid in a sentence.

  • What happened to search for and replace special characters

    I'm a recent update of FrameMaker 9 FrameMaker 11. I use several notations with nonbreaking hyphens and nonbreaking spaces. In version 9, I was able to use the hexadecimal codes in the Find/Replace dialog box and search and replace these ratings. Now in version 11, it does not find these characters. I end up getting more I want.

    For example: I want to find

    (E Vote, September 12, 2008)

    This text has a non-breaking hyphen and showing spaces are nonbreaking. When I entered the document these characters, I used the combination of keys "Esc hyphen:" for the hyphen and "Ctrl + space" for spaces.

    When I enter "(E\x15Vote\x10Sept.\x1012,\x102008)" and press the button Search, FrameMaker converts the text to "(E\+Vote\s#Sept.\s#12,\s#2008)" and refers to a "Not Found" statement. I get the error even if I copy the text and paste it into the Find/Replace dialog box. I tried with "Deal", "use wildcards" and whole-word checks both market. I can't find it.

    Honestly, I never noticed if verstion 9A made the conversion of \x15 to------+ and dialog of \x10 to \s#, in the search/replace because he always found what I was looking for.

    I hope someone can tell me how to solve this problem, because it is a feature I use all the time in FrameMaker. I use hyphens and nonbreaking spaces everywhere in my documents.

    I also reported this as a bug because that's what happens if feels like to me. I went out and updated my installation of FrameMaker, thinking that this may have been reported and already corrected.

    A sad FrameMaker user

    Chris

    I'm not sure that's what you're looking for, but you might.

    Copy your text ' E-voting, September 12, 2008'.

    Go to Find/replace

    Select text and character Formats Clipboard from the drop-down

    Click on Search.

  • Replace special characters in the FDF

    Hello

    I've looked everywhere and can't find the answer to this simple problem.  I can handle javascript in an HTML environment using free scripts, but it is not so easy in a PDF form.  I use Adobe Acrobat 9 Pro and I have a form that once completed and submitted, generates and sends a FDF file.  I use a script on the server side, called FormGenie do this and the script hate parentheses and some other characters, they break the FDF file.  Everything I want to do is set up a document level Javascript that find and replace all instances of these special characters with something license as a hyphen - or just a space.

    I tried:

    function clearText() {}
    document. FormName.FieldName.Value = filterNum (document. FormName.FieldName.value)

    function filterNum (str) {}
    re = /\$|#|~|\%|\*|\^|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\"|\<|\>|\?| \|| \\|\!| \$/g;
    remove special characters as ' $' and ',' etc...
    return str.replace (re, "-");
    }
    }

    and

    function clearText2 (str) {}

    stringName = stringName.replace (/------$| #| ~ |------% |------* |------^ | \(|\) |--------+ |------= |------[|------] |------[{|------} |------{|------; |------"|"}]) ------< | ------> | \ ? | \|| \\|\!| \$ /g,'-');
    }

    I know that these are not good, but I have to be at least barking to the top of the tree on the right.

    Can anyone help?

    Thank you

    You create the form in Acrobat or LiveCycle Designer?

    In general, you can place a script typo in the script of the text of each filter field field hit, in the case where something replacing the user typed with something else would not cause the concern of the user. An alternative would be to be implemented a script that parses the fields just before the submission form action takes place and not to replace them.

    For example, you can use the following JavaScript typo customized for text fields created in Acrobat:

    If (! event.willCommit) {}

    Event.change = event.change.replace (/ [------$# ~ %------*------*------^ \ (\)------+=------[\]------{\};------"\<\>\?]) \ | \\\ !] /g, "-");

    }

    and it will replace these characters when the user types the data into a text field. May not include all the character you want replaced, but you should get the idea.

  • Sometimes when you view an Acrobat file created by others, square replace some characters.  How can I stop this?

    Sometimes when you view an Acrobat file created by others, square replace some characters.  How can I stop this?

    Hi John -.

    It seems that no one has answered your question. Sorry for the long wait!

    Squares can replace characters when you're dealing with missing fonts, or who are poorly integrated. It is important to see the text, you can ask the person creating the document to convert the PDF image pages PDF file, which then displays the fonts.

    Places instead of the characters may appear if you are using a scanned page, for example and capture the text.

    Donna.

  • Replace sepcial characters in a Server stored on via PLSQL

    Hi Experts,

    I have a requirement in which I need to replace special characters by alphabets in a file stored on the server in a directory.

    EG - symbol € with E

    symbol (at) with @.


    I want to do this via a Pl Sql stored procedure.

    I tried and script worked great for small files, but it is a failure for large files.


    for your Script reference, I've been trying-


    DECLARE

    l_tmp_blob by DEFAULT EMPTY_BLOB() BLOB;

    l_bfile BFILE.

    l_dest_offset INTEGER: = 1;

    l_src_offset INTEGER: = 1;

    l_file_content VARCHAR2 (32767).

    l_outfile UTL_FILE. TYPE_DE_FICHIER;

    BEGIN

    l_bfile: =.

    BFILENAME ('TEST_ATTACH ','TEST_ZERO_SIZE.txt '

    );

    DBMS_LOB. OPEN (l_bfile, DBMS_LOB.file_readonly);

    DBMS_LOB.CREATETEMPORARY (l_tmp_blob, TRUE);

    DBMS_LOB.loadblobfromfile (l_tmp_blob,

    l_bfile,

    DBMS_LOB.lobmaxsize,

    l_dest_offset,

    l_src_offset

    );

    DBMS_LOB. CLOSE (l_bfile);

    BEGIN

    SELECT mob_util_pck.blob_to_varchar (l_tmp_blob)

    IN l_file_content

    Double;

    END;

    Start

    mob_util_pck. DELETE_FILES ("TEST_ATTACH",

    'TEST_ZERO_SIZE.txt '.

    );

    END;

    l_file_content: = REPLACE (l_file_content, ' €', 'E');

    l_file_content: = REPLACE (l_file_content, ' @', '(at)');

    l_file_content: = REPLACE (l_file_content, '&', '+');

    l_file_content: = REPLACE (l_file_content, 'to', 'a');

    l_file_content: = REPLACE (l_file_content, 'e', 'e');

    l_file_content: = REPLACE (l_file_content, 'e', 'e');

    l_file_content: = REPLACE (l_file_content, c ","c");

    l_file_content: = REPLACE (l_file_content, 'e', 'e');

    l_file_content: = REPLACE (l_file_content, 'u', 'u');

    l_file_content: = REPLACE (l_file_content, 'e', 'e');

    l_file_content: = REPLACE (l_file_content, 'i', 'i');

    l_file_content: = REPLACE (l_file_content, ' \', ' / ');

    l_file_content: = REPLACE ([l_file_content, '] ',')');

    l_file_content: = REPLACE (l_file_content, ' ^ ','.');

    l_file_content: = REPLACE (l_file_content, '_', '-');

    l_file_content: = REPLACE (l_file_content, "',"');

    l_outfile: = UTL_FILE. FOPEN ('TEST_ATTACH', 'TEST_ZERO_SIZE.txt', 'w');

    UTL_FILE. PUT (l_outfile, l_file_content);

    UTL_FILE. FCLOSE (l_outfile);

    END;

    /

    Please help me with this.

    Regards-

    Vikrant

    I'm testing with CLOB, but I don't know if I can REPLACE on CLOB and write a file with the CLOB.

    REPLACEMENT work, UTL_FILE doesn't.

    You can use, for example:

    DBMS_XSLPROCESSOR.clob2file (l_tmp_clob, 'TEST_ATTACH', 'TEST_VIKS1108062013115301.xml');

  • replace multiple spaces with a space

    Hello
    Oracle 11g R2.

    Looking for a way to replace multiple spaces in a row by a space. For example, the 'abc abc' text should look like 'abc abc '. I tried to play with replace, but it only works in the case of 2 spaces. Need a solution for cases where there may be 2 or more spaces.
    select replace(column1, chr(32)||chr(32), chr(32)) from tablea

    Use regular expressions:

    Select regexp_replace (column1, '{2}',' ') from tablea;

    SY.

  • Need to replace specific characters of columns

    Hello.

    I searched the forum and found examples to follow, but I'm stumped. I am using regex_replace to replace special characters in a column with a space. The characters are as follows: #/--------| <>* $?; :, @' ^

    I got this close:
    SELECT NAME,
    REGEXP_REPLACE (NAME, ' [#/--------| <>* $?;:, @^] ',' ')
    OF PRODUCT_DESIGNS

    My problem is: How can I replace the apostrophe? I can't make it work in the same REGEX_REPLACE like all the other characters.

    Thanks for your time.

    Dan

    Hello

    TRANSLATE is more effective than REGEXP_REPLACE to do this:

    SELECT     name
    ,     TRANSLATE ( '#/\|*$?;:,@^'''
                , '             '
                )
    FROM    product_designs
    ;
    

    To include a single quotation mark in a string literal, use two of them in a row.
    Notice how the first argument to TRANSLATE above:

    ,     TRANSLATE ( '#/\|*$?;:,@^'''
    

    is written with 3 consecutive single quote at the end characters. The first two show a single quotation mark in the literal and the third one ends the literal.

    You can also use Q-rating to include a single quotation mark in a string literal:

    ,     TRANSLATE ( q'<#/\|*$?;:,@^'>'
                ,  '             '
                )
    

    Published by: Frank Kulash, August 20, 2010 12:03
    Added example of scoring Q

  • replace the characters with accent with their basic letter

    Hello

    I need to replace the characters with an accent with their basic letter

    a = > has
    n = > n

    I use classes of equivalence as [[= n =]] in regexp_replace, but then I need to call it for each letter. Is there a simpler way?

    Concerning
    Marcus

    Given that I only have the names to convert INITCAP

    It seems that you can use the binary case-insensitive or accent sorting to get the results you want so:

    SQL> with t as (
     select 'ñÉäßÑéàâ' str from dual
    )
    --
    --
    select str, utl_raw.cast_to_varchar2((nlssort(str, 'nls_sort=binary_ai'))) str2 from t
    /
    STR      STR2
    -------- ---------------
    ñÉäßÑéàâ neassneaa
    1 row selected.
    
  • convert integers in equivalent characters in string - character of ASCII code

    I got out of my data and information of the associated string to an array of strings, and then to a spreadsheet file.

    I want to do this by converting an identical string of characters (integers and other numbers).

    I tried Type font with a constant string as the input of type but it DOES NOT WORK.  Instead, I get the ASCII character whose numeric designation corresponds to the integer, for example integer '50' become 'P' capital.

    I want all over '50' string '50 '.

    Please advise, and no, I don't want to make the berries of the clusters.

    I found my answer, but only after the search for 'Number' rather than 'Integer' conversion conversions.

    In the range of programming - number of string - string/number of Conversion - decimal string functions:

    'Converts number to a string of decimal digits less than width characters wide or more if necessary. If the number is floating point, it is rounded up to a 64-bit integer before the conversion. »

  • Type special characters in the character map

    How do I enter special in character map charaters, when they are not visible? With this font, Roman playground Pro, they do not appear under "unicode" but rather "Basic Latin", "formulas"Terminal"or"Initial forms", which none appear in the table of characters."

    Hello

    Were there any changes made recently to the computer?

    I suggest you follow this article.

    Using special characters (character map): frequently asked questions: http://windows.microsoft.com/en-US/windows7/Using-special-characters-Character-Map-frequently-asked-questions

    I hope this helps.

  • replace special characters in sql select

    Hello

    I have a little problem with one colunm blob in a db.

    A blob contains a text with decimal characters (an application writes this colunm in HTML), for example:

    Kedves Koll & #233 g & #225; k!

    & #193; He's & #225; sfoglal & #225; sotokat k & #233; RJ & #252; k a csatolt panasz & #252; gyben (PI-1167/2014.).

    & #220; gyf & #233; ladatok

    n & #233; v: lives & #225; RIS Anetta

    How could I replace the decimal characters with ascii characters?

    Thans a lot

    set define off

    SELECT UTL_I18N. UNESCAPE_REFERENCE ('Kedves Kollegak!)

    Allasfoglalasotokat Kerjuk a. csatolt panaszugyben (PI-1167/2014.)

    Ugyfeladatok

    Nev: Anetta Vitaris') FROM dual

    UTL_I18N. UNESCAPE_REFERENCE('KEDVESKOLLéGáK!) Allasfoglal & #225

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

    Kedves Kollegak!

    Allasfoglalasotokat Kerjuk a. csatolt panaszugyben (PI-1167/2014.)

    Ugyfeladatok

    Nev: Vitaris Anetta

    1 selected line.

  • Replacing special characters with its actual value

    Hi all

    Anyone have an idea how to replace an extended character (ASCII ranging from 128 to 255 value) for its actual character set in SQL/PLSQL?

    For example: '½' should be replaced on a "1/2".
    '¼' should be replaced with "1/4"

    Ultimately if the value is "California 71 ½" then the result should be "California 71 1/2". "."

    Thanks for your time!

    Kind regards

    REPLACE the function?

    SQL> select replace('California 71 ½', '½', '1/2') from dual;
    
    REPLACE('CALIFORNIA71½','½','1
    ------------------------------
    California 71 1/2
     
    
  • Keep multiple instances of unique data

    Hi all




    I'm a newbie to this site. I wanted to know if we can configure unique custody of data for multiple data (instances), has that been done any time in the past.

    I know that sounds weird, but we are a small business and rapid growth. We want to reduce the cost at the same time.

    In addition to this you know another method or practical and economic approach to synchronize data between multiple production system in the centralized system of DR


    Sorry, if I posted it in the wrong section.


    Thanks in advance for your help and your time.


    N

    Published by: 960081 on October 17, 2012 12:36

    Hello

    A database of pending cannot behave like that makes sense both physical standby at the same time. As I said earlier, a database can have multiple databases on hold, you can have logical and physical database waiting for your provided unique primary databases Eve logical and physical are 2 databases and not only 1 database

Maybe you are looking for

  • I cannot see how many messages is in or the size of the trash or sent folders after upgrading to 3.1.10

    Recently, I upgraded my Thunderbird client to 3.1.10 of 2.2xx and I see is no longer the size of the files or how many messages are in some cases. Records show how many are unread, but not the total number of messages or the size of the data in the f

  • ThinkPad Edge 14 (0578RD 4) WLAN driver issues

    I bought the new laptop Thinkpad Edge 14 about 4 days back. I installed Windows 7 ultimate and continuous with the installation of the drivers. All the drivers installed fine but my WiFi detects no signal. I contacted lenovo support and they took my

  • problem with "video driver" (maybe missing?)

    Hello. I am not very savvy at all so bear with me on this... I got some a little update last night from windows (?) thing saying my video driver missing or messed up somehow and that I needed to download a new or redownload in computer it... and then

  • T410s disconnection/reconnection

    Hi, I have a relatively new T410s that was working very well, until recently. A few nights ago I noticed that my Wi - Fi kept disconnect and then reconnect without reason. Can someone tell me in layman's terms what is the problem and how to fix it? T

  • 1:1 previews don't accelerate library?

    When I import my RAW files in LR6, I generate 1:1 previews.  And I have LR value never remove the 1:1 previews.  My RAW cache is set to 40 GB.I keep files RAW on a USB2 drive is connected to the Mac.  I keep the LR catalog and previews on an SSD in t