REGEXP_REPLACE problem with special characters in the string

Hi guys,.

I have had problems using the REGEXP_REPLACE function and I'm trying to find a solution.

The closest I can get is this thread:

Re: How to replace the first occurrence of a substring

and that's only because the solution, I'm trying to achieve is the one suggested. I did ppost my problem there, but because it is answered, I don't have an answer.

I'm doing the following:
select 
  regexp_replace('A*|A*|C11|A1|A*||_|OR|H452|C40|A|A*||_|AA|1151|G31|A1|A||_|EX|8HI01|H11|A1|A||_|OCR|H421|B11|A|||_|OR|H434|C11|A|||_|AQA|9990|E10|EP|||_|AA|2151|G31|A|||_|',
  '^(\w|-)*\|{1}',null)
from dual
Basically, replace it does not work, because the first part of the string contains an asterisk. If you delete the Asterix, then replace it won't work.

How can I get around this? I can't use a regular REPLACEMENT as I want to remove the first instance of A * and not all instances of the A.

Help, please! I don't know what to do... probably, I mustn't start a loop through the string?

Thanks in advance guys!

Robin

User_resU wrote:
I want to remove the first instance of A * and not all instances of the A.

To decode your regular expression, it seems that you want to remove A * | and not just A *.

SQL> select   regexp_replace('A*|A*|C11|A1|A*||_|OR|H452|C40|A|A*||_|AA|1151|G31
|A1|A||_|EX|8HI01|H11|A1|A||_|OCR|H421|B11|A|||_|OR|H434|C11|A|||_|AQA|9990|E10|
EP|||_|AA|2151|G31|A|||_|',
  2    '^(\w|-)\*\|{1}',null) reg
  3  from dual;

REG
--------------------------------------------------------------------------------

A*|C11|A1|A*||_|OR|H452|C40|A|A*||_|AA|1151|G31|A1|A||_|EX|8HI01|H11|A1|A||_|OCR

|H421|B11|A|||_|OR|H434|C11|A|||_|AQA|9990|E10|EP|||_|AA|2151|G31|A|||_|

Tags: Database

Similar Questions

  • problem with special characters

    I have a problem with special characters. When I save a project or for export.

    & yacute;  figure like & Yacute;

    & uacute;   is shown as & Uacute;

    & aacute;  figure like & Aacute;

    & iacute; figure as & Iacute;

    & oacute;   is shown as & Oacute;

    & eacute;   appears under the name & Eacute;

    Hi Stephan,

    This has been fixed in the latest version of reflow; Please install the latest version.

    Thank you

    -irina

  • How to remove special characters from the string using translate() without typing all special characters?

    Hi all

    I am trying to remove special characters without the help of regular expressions.

    translate (the column name or string,'!@#$ & * (* () _) * "" :} {?}) >? /, «, » ')

    I want to eliminate this manual process to give all special characters using a chr() or ascii() function.

    Please show me the way.

    Thanks in advance

    Similar to the solution of Michael...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, i like (select level 1 c from dual connect by level<=>
    3 less
    4 Select + 32 (level-1) double connect by level<=>
    5 less
    6 select + 58 (level-1) double connect by level<=>
    7 less
    8 select + 91 (level-1) double connect by level<=>
    9 less
    10. Select 123 + (level-1) from dual connect by level<=>
    11 less
    12. Select 255 double
    13            )
    14, ts as (select level r, substr (str, level 1) c
    15 t
    16 connect by level<=>
    17             )
    18, tf as (select row_number() (order for r) r
    19                    ,ts.c
    20 TS
    21 I join on (i.c = ascii (ts.c))
    22             )
    23 select replace (sys_connect_by_path(c,'!'),'! ') Str
    24 TF
    25 where connect_by_isleaf = 1
    26 connect r = prior r + 1
    27 * start with r = 1
    SQL > /.

    STR
    -----------------------------------------------------------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

    Or something as horrible as this...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, I like (select replace (sys_connect_by_path (chr (c), 'A'), 'A') as tr)
    3 of)
    4 select c, rownum r
    5 (select 32 + (level-1) as the double connection by level c<=>
    6                         union
    7 select + 58 (level-1) double connect by level<=>
    8                         union
    9 select + 91 (level-1) double connect by level<=>
    10 the union
    11. Select 123 + (level-1) from dual connect by level<=>
    12 union
    13. Select 255 double
    14 tri 1
    15                        )
    16                  )
    17 where connect_by_isleaf = 1
    18 log r = prior r + 1
    19 start with r = 1
    20            )
    21 select translate (str, 'A' |) TR, 'A') as str
    22 * t, I
    SQL > /.

    STR
    --------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

  • empty data file with special characters in the name

    Hi all

    I'm having a problem with an empty data file which is in recovery mode.

    Before the following has been a success:
    ALTER database create datafile 'fully_qualified_file_name' as 'fully_qualified_file_name ';
    recover data file "fully_qualified_file_name";
    ALTER database datafile 'fully_qualified_file_name' online;

    But this time it does not work as I get an error:
    ORA-01516: file nonexistent journal, data file, or temporary file
    Using the file id does not work either.

    When I created a record of control file I see the data file has special characters in the name:
    ' / oracle/PRD/112_64/dbs/PSPR3I ^? ^?'

    Since it is empty, it would be possible to create the data file void anothr
    using the:
    ALTER database create datafile ' / oracle/PRD/112_64/dbs/PSPR3I ^? ^?'
    as ' / oracle/PRD/spdata2/r3i_8/r3i.data8';

    and then recover datafile 'fully_qualified_file_name ';
    ALTER database datafile 'fully_qualified_file_name' online;

    How orders oracle faced with special characters?

    Thanks for your advice

    user6737818 wrote:
    Hi all

    I'm having a problem with an empty data file which is in recovery mode.

    Before the following has been a success:
    ALTER database create datafile 'fully_qualified_file_name' as 'fully_qualified_file_name ';
    recover data file "fully_qualified_file_name";
    ALTER database datafile 'fully_qualified_file_name' online;

    But this time it does not work as I get an error:
    ORA-01516: file nonexistent journal, data file, or temporary file
    Using the file id does not work either.

    When I created a record of control file I see the data file has special characters in the name:
    ' / oracle/PRD/112_64/dbs/PSPR3I ^? ^?'

    It should work using a file as the definition of source file number and a new name for the new file. Works for me:

    orcl> alter database create datafile 7 as 'c:\tmp\newname.dbf';
    
    Database altered.
    
    orcl>
    
  • Problem with special characters when retrieving the server information

    Hi all

    I use a HttpConnection to get data from a server, and sometimes there are a few very unusual characters. The data comes from the server in the format UTF-8 and converted into ISO-8859-1 does not work for Cyrillic more obscure.

    I looked into this and I just can't work at what point in this code, I can convert the character set.

    HttpConnection connection = (HttpConnection) Connector.open(url
                        + connSuffix);
    
                connection.setRequestMethod(method);
                if (method.equals("POST") && postData != null) {
                    connection.setRequestProperty("Content-type",
                            "application/x-www-form-urlencoded");
                    OutputStream requestOutput = connection.openOutputStream();
                    requestOutput.write(postData);
                    requestOutput.close();
                }
                int responseCode = connection.getResponseCode();
                if (connection instanceof HttpsConnection) {
                    HttpsConnection secureConnection = (HttpsConnection) connection;
                    String issuer = secureConnection.getSecurityInfo()
                            .getServerCertificate().getIssuer();
                    UiApplication.getUiApplication().invokeLater(new DialogRunner("Secure Connection! Certificate issued by: " + issuer));
    
                }
    
                if (responseCode != HttpConnection.HTTP_OK) {
                    screen.requestFailed("Unexpected response code: "
                            + responseCode);
                    connection.close();
                    return;
                }
    
                String contentType = connection.getHeaderField("Content-type");
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
    
                InputStream responseData = connection.openInputStream();
                byte[] buffer = new byte[10000];
                int bytesRead = responseData.read(buffer);
                while (bytesRead > 0) {
                    baos.write(buffer, 0, bytesRead);
                    bytesRead = responseData.read(buffer);
                }
                baos.close();
                connection.close();
    
                screen.requestSucceeded(baos.toByteArray(), contentType);
            } catch (IOException ex) {
                screen.requestFailed(ex.toString());
            }
    

    Everything works fine, but I really want to convert the output to UTF-8.

    Thanks for any help in advance.

    Does that help?

    InputStream responseData = connection.openInputStream ();
    ubyte [] buffer = IOUtilities.streamToBytes (responseData);

    responseData.close ();

    Connection.Close;

    String redsponseString = null

    try {}

    responseString = new String(buffer,"UTF-8");

    }

    responseString was correctly converted using UTF - 8.

    You might want to empty the bytes received using something like this:

    http://supportforums.BlackBerry.com/T5/Java-development/convert-UTF-8-encofed-text-to-hex-decimal/m-...

  • Problems with special characters with Apex5

    Hello together,

    I hope, I'm right on this forum with this problem, I have found no other best match.

    I have a single database called apex12D on 12.1.0.2 it's my database of the 5 Apex develompent. Apex 5.0.2 is installed, also the German language of Apex. The OS is Oracle Linux 6.

    On a second machine that I have configured the Oracle Data Service remains with tomcat (installed from the repositories) and apache (also installed deposits), running on the Oracle Linux 7 operating system. This machine is my "http server" to connect to my Apex environment. Everything is very well workung, but when I go on my Apex Admin Backend all special characters in German (A, U, O,...) are displayed incorrectly. Which looks very good.

    What makes that I made:

    To the database (apex12D), I put all the nls paramereters the installation of the database of German letters:

    SYS@apex12D> select * from nls_database_parameters;
    
    
    PARAMETER VALUE
    ---------------------------------------------------------
    NLS_RDBMS_VERSION 12.1.0.2.0
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_LENGTH_SEMANTICS BYTE
    NLS_COMP BINARY
    NLS_DUAL_CURRENCY ?
    NLS_TIMESTAMP_TZ_FORMAT DD.MM.RR HH24:MI:SSXFF TZR
    NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR
    NLS_TIMESTAMP_FORMAT DD.MM.RR HH24:MI:SSXFF
    NLS_TIME_FORMAT HH24:MI:SSXFF
    NLS_SORT GERMAN
    NLS_DATE_LANGUAGE GERMAN
    NLS_DATE_FORMAT DD.MM.RR
    NLS_CALENDAR GREGORIAN
    NLS_NUMERIC_CHARACTERS ,.
    NLS_NCHAR_CHARACTERSET UTF8
    NLS_CHARACTERSET AL32UTF8
    NLS_ISO_CURRENCY GERMANY
    NLS_CURRENCY ?
    NLS_TERRITORY GERMANY
    NLS_LANGUAGE GERMAN
    
    
    20 rows selected.
    

    SPFILE parameters tells a different story, I tried to put them with "change the database < parameter > = < value > scope = spfile" and if a database has restarted, nothing changes.

    SYS@apex12D> show parameter nls
    
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    nls_calendar                         string      GREGORIAN
    nls_comp                             string      BINARY
    nls_currency                         string      $
    nls_date_format                      string      DD-MON-RR
    nls_date_language                    string      AMERICAN
    nls_dual_currency                    string      $
    nls_iso_currency                     string      AMERICA
    nls_language                         string      AMERICAN
    nls_length_semantics                 string      BYTE
    nls_nchar_conv_excp                  string      FALSE
    nls_numeric_characters               string      .,
    nls_sort                             string      BINARY
    nls_territory                        string      AMERICA
    nls_time_format                      string      HH.MI.SSXFF AM
    nls_time_tz_format                   string      HH.MI.SSXFF AM TZR
    nls_timestamp_format                 string      DD-MON-RR HH.MI.SSXFF AM
    nls_timestamp_tz_format              string      DD-MON-RR HH.MI.SSXFF AM TZR
    SYS@apex12D>
    

    Interestingly, it is that when I write a pfile to the bottom of my spfile and open it with vi, everything looks great. But OK.

    apex12D.__data_transfer_cache_size=0
    apex12D.__db_cache_size=2030043136
    apex12D.__java_pool_size=50331648
    apex12D.__large_pool_size=385875968
    apex12D.__oracle_base='/usr/local/oracle'#ORACLE_BASE set from environment
    apex12D.__pga_aggregate_target=536870912
    apex12D.__sga_target=3221225472
    apex12D.__shared_io_pool_size=150994944
    apex12D.__shared_pool_size=570425344
    apex12D.__streams_pool_size=16777216
    *.audit_file_dest='/usr/local/oracle/admin/apex12D/adump'
    *.audit_trail='db'
    *.compatible='12.1.0.2.0'
    *.control_files='+DATA_QUM169/APEX12D/CONTROLFILE/current.505.898513523','+FRA_QUM169/APEX12D/CONTROLFILE/current.2094.898513525'
    *.db_block_size=8192
    *.db_create_file_dest='+DATA_QUM169'
    *.db_create_online_log_dest_1='+DATA_QUM169'
    *.db_create_online_log_dest_2='+FRA_QUM169'
    *.db_domain=''
    *.db_name='apex12D'
    *.db_recovery_file_dest='+FRA_QUM169'
    *.db_recovery_file_dest_size=10240m
    *.diagnostic_dest='/usr/local/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=apex12DXDB)'
    *.local_listener='LISTENER_APEX12D'
    *.log_archive_dest_1='LOCATION=+FRA_QUM169'
    *.log_archive_dest_2='LOCATION=+DATA_QUM169'
    *.log_archive_format='%t_%s_%r.dbf'
    *.nls_currency='$'
    *.nls_date_language='GERMAN'
    *.nls_dual_currency='$'
    *.nls_iso_currency='GERMANY'
    *.nls_language='GERMAN'
    *.nls_territory='GERMANY'
    *.open_cursors=300
    *.pga_aggregate_target=512m
    *.processes=600
    *.recyclebin='OFF'
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=3072m
    *.undo_tablespace='UNDOTBS1'
    

    The server' http' ADR is configured under the orards user, so I've put this in the .bash_profile:

    NLS_LANG=GERMAN_GERMANY.AL32UTF8
    
    
    export NLS_LANG
    

    The same I did for the root, just for test user, because only root can start tomcat and apache systemctl. Apache and tomcat user/bin/nologin as Bash, so I think that their bash_profile will not if I create a.

    But nothing really worked. Can anyone help please?

    Thank you and best regards,
    David

    Hello

    good German special characters are agree on the first server in ther, but not the second? I have this behavior when I set NLS_LANG = GERMAN_GERMANY. AL32UTF8 when I install the extension of the German language.

    Best regards

    Thomas

    (Grussle aus Böblingen)

  • Problem with special characters in a language other than English

    I need to load the Spanish language in the apex; to do this follow these steps

    SELECT the parameter, value

    OF nls_database_parameters

    WHERE PARAMETER like '% % NLS '.

    NLS_LANGUAGE SPANISH

    NLS_TERRITORY SPAIN

    WE8MSWIN1252 NLS_CHARACTERSET

    In the linux console

    Export NLS_LANG = SPANISH_SPAIN. WE8MSWIN1252

    sqlplus / as sysdba

    SQL > select 'Annnnnnnn' text of double;

    TEXT

    ---------

    Annnnnnnn

    1 fila seleccionada.

    SQL > ALTER SESSION SET CURRENT_SCHEMA = APEX_040200;

    SQL > @load_es.sql;

    Procedure-PL/SQL terminado correctamente.

    SQL >

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

    But when I go to APEX I see problems with the display of the characters.

    apexlanguage.png

    Appreciate any help!

    Thank you!

    Martin

    Solved!

    Use another NLS_LANG

    Export NLS_LANG = SPANISH_SPAIN. AL32UTF8

    sqlplus / as sysdba

    @unload_es.sql;

    @load_es.sql;

    And now works fine.

    Martin

  • Problem with special characters: € among others

    Hello world

    I'm updating some special characters on my DB.

    But every time I try to put up-to-date I always get the same data, even if the YPDATE Clause says that the data has been successfully updated.

    For example, whenever I try to update and € sign, it does according to the UPDATE clause, but is not on the table.

    Any advice on how to proceed?

    I really appreciate your advice.

    Best regards.

    Jaison

    Published by: Stephanie on 27-ene-2012 08:56

    Stephanie wrote:
    Would it just enough to do that?
    ...

    It is an ancient and not recommended, method which can corrupt data.

    Instead, please read about changing tank db in the Migration of the character value:
    http://docs.Oracle.com/CD/E11882_01/server.112/e10729/ch11charsetmig.htm

    The first recommendation is to fully export and import a new database with the correct character sets.

  • Problem with special characters loaded from XML

    I have a XML with elements that contain special characters (for example: n, N, a, A, etc.), when I load the code XML and do a Trace () the element responsible, I see that it is loaded correctly, but in the text field is not special characters. For example, in the XML file, I have the Bañostext, but in the field indicated text Baos.

    It is clear that in the text field consist of uppercase, lowercase, numbers, punctuation symbols, and basic Latin characters.

    I also tested with stop System.useCodePage = true in the code, but does not.

    Thanks for any help you can give me.

    Garchabig.

    PD: Sorry for the bad English, I'm Latino. -

    embed a font that contains the characters required.

  • Problem with special characters in a column

    Hello, I call data from a database and I don't have the rights to the database, the name of the columns have points on behalf here: Parameters.12V_Prog_IccType_A

    Is there a way to solve this problem with the name change? Like using (de), [,], "", or something like that?

    BR,

    Robin

    Try the square brackets.

    Mike...

  • How to avoid special characters in the string box

    Hello

    is it possible that a special character can be avoided in a box of the string, as authorizing only a - z and 0-9 to enter a box in the chain

    Hi all

    Darin Laurette method is simple.

    AnkitG: You must change the code.

    Good learning for me.

    Kind regards

    Leila

    CLD

  • Glossary problem with special characters.

    Hello

    I have to Add a/c as a term in the glossary (by plane).

    It seems to be well understood, but after the publication, the term a/c is not active: I can not click on it.

    Could you tell me how to enter this term in order to allow the glossary work correctly for this term.

    Thank you in advance.

    Best regards

    Catherine

    Sorry, glossary widget is very strict for special characters, it does not support the characters in combination like u n or

  • XML and problem with special characters

    Hi all

    I have an application, here and there, some customers complained that it doesn't. I studied their xml files, and eventually I found the problem. If there is a @ or & in the value of the item it does not work. I don't know if any of you have had this problem, if you could you please say regarding how I can manage these characters or even disable these as input.

    Thanks in advance

    Thanks for your help guys, I did a little more digging. UTF - 8 does not, but UTF-16 only and yes the & amp should be used instead of the & symbol.

  • 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

  • Special characters in the wrong Exif IFD0 (ImageDescription) export

    Someone at - it having problems with special characters such as a, o, u, e, to?

    I have a description of the image written to the IPTC section which Lightroom stores in EXIF too. Most GUI display the correct characters, but if you look at the Exif IFD0 part these characters are changed.

    In the example, you see that the 'u' is missing in 'Innsbrücke' below.

    Exif_IFD0.png

    You can see the original image here:

    http://www.Hirst.ch/content/09%20Ferien/2010%20-%20Adlerweg%20-%20Teil%202/2010%20-%20Adle rweg%20II%20-%20017.jpg

    The following link shows how the extracted tag of EXIF (ImageDescription) gets poster:

    http://www.Hirst.ch/#/content/09%20Ferien/2010%20-%20Adlerweg%20-%20Teil%202/2010%20-%20Ad lerweg%20II%20-%20017.jpg

    Just to show that there is nothing wrong with the GUI, check after the example (not exported Image with LR3) which work perfectly well:

    http://www.Hirst.ch/content/09%20Ferien/2008%20-%20Jordanien/2008%20-%20Jordanien%20-%2002 6. jpg

    http://www.Hirst.ch/#/content/09%20Ferien/2008%20-%20Jordanien/2008%20-%20Jordanien%20-%20 026 jpg

    Exif_IFD0_2.png

    Any help on getting these correct special characters in EXIF would be very much appreciated.

    Thank you

    It always resembles a UTF-8 conversion tank Latin problem.

    Honestly, most former EXIF fields are not going to be able to handle characters-international, but what is stored there, and what is displayed in the interfaces will be highly contextual.

    The plugin I mentioned can be used to standardize the metadata in order to minimize this problem.

Maybe you are looking for

  • Satellite 1130 set up an internet connection

    I am trying to set up an internet connection on my laptop using a disc of wanadoo, and all I get is an error message saying cannot establish a connection. tried about 6 times in total and still does not connect. The computer modem works fine, the onl

  • To move the library continues to be the library system hard disk

    Hello everyone, I would like someone to help me with this question. I've migrated the pictures opening. My library as subject of 70,000 photos. Everything went well. I imported the photos keeping referenced masters to na DHM (external hard drive). Bu

  • HP 2000: Problem connecting Wifi with HP 2000

    I have a laptop HP 2000 used recently. I was able to connect to my WiFi at home, but drop it and saying 'Limited connection' or 'no. Internet Connection. I have the latest drivers for my network cards.  Could it be caused by a faulty Wifi card? Could

  • LRT214 + LAPACPRO1750: Configure to allow VNC connections.

    Greetings: Background: I'm working on a small network that uses a bunch of macintosh computers. They have a comcast business portal, which they have LRT214 connected as well as a DMZ if the firewall is down and all traffic goes to the LRT214. Macs to

  • Malfunction of the equipment!

    I have a Dell Inspiron e1505 and received a * hardware malfunction *... my husband then farm our laptop and now when I start the laptop is on, but the screen is completely black. I placed and external display and the same message appears. What can I