Expression regular replacement

Hi gurus,

I have as a result string and replace the string with tags as follows.
 |3 String1 |0 some text  |4 String2 |0 

to

 < i >  String1 < /i > some text < b > String2 < /b >

i.e. Want to replace |3 to < i >
                             |0  to  < /i >      -- First occurrence of |0
                     
                             |4 to < b > 
                             |0 to < /b >      -- Second occurrence of |0
Thanks in advance,
with t as (
           select '|3 String1 |0 some text  |4 String2 |0' str from dual
          )
select regexp_replace(
                      regexp_replace(
                                     str,
                                     '\|3(.*?)\|0',
                                     '\1'
                                    ),
                      '\|4(.*?)\|0',
                      '\1'
                     )
  from  t
/

REGEXP_REPLACE(REGEXP_REPLACE(STR,'\|3(.*?)\
--------------------------------------------
 String1  some text   String2 

Elapsed: 00:00:00.02
SQL> 

SY.

Tags: Database

Similar Questions

  • Expression regular/replace - Oracle 7.3

    Hello!

    I have tried SQL regular expression from 10g to Oracle 7.3 functions and it seems that the old version does not have this feature yet.


    'Aaaa, Bbbb'-> 'Aaaa, Bbbb.

    "REPLACE *", [0-9a - Za - z] "* WITH *", "*".




    The chain model is to look for the signs point of punctuation that is not immediately followed by whitespacess so I can replace it with a comma followed by a space.

    No work around for this?

    You can try something like this:

    select replace(replace(yourcolumn, ',', ', '), ',  ', ', ') from yourtable;
    

    Idea:

    Step 1:
    First of all, we replace all the ',' with ','.
    Now every comma will be followed by at least one blank.
    Step 1 is done by inside to replace in my code.

    Step 2:
    Then we replace all ','with','.
    This step removes the double spaces, which were produced by the first step.
    Step 2 is done by outside replace in my code.

    The problem is that this solution represents only white, but not other areas.
    To get rid of the other spaces you can replace them with blanks before step 1.

    Published by: hm on 01.08.2011 05:10

  • Expression regular slash before?

    I'm trying to use a regular expression to replace all the slashes in a selection.

    I tried the following, my performance desired is 0 m [div] s + s 16.67 m [div].

    var str = "0 m/s + 16.67 m/s";
    var output = str.contents.replace(/[/]/gi,"[div]"); //output "0 m/s + 16.67 m/s"
    

    Thanks in advance for any help is to solve it.

    Hi KuddRoww,

    simply to escape the slash should help (and chain is not necessary: content)

    var str = "0 m/s + 16.67 m/s";
    var output = str.replace(/\//gi,"[div]"); // "0 m[div]s + 16.67 m[div]s"
    alert(output);
    

    Have fun

  • Since version 18.0.0, Firefox regularly replace some parts of my screen when it is enlarged but not active (Outlook or Word); is there any solution for this?

    Any time I can get Firefox enlarged but not active (so it is behind another active window / application) on Windows XP Pro SP3, it regularly replace significant portions of my screen. If I move the mouse, type, scroll up/down or anything to change the screen, the active application is slowly starting to appear. For example, in Office 2007, when this happens, I can continue typing a sentence in Word or Outlook and this line is displayed, but the rest of the message area displays remnants of Firefox. If I move the mouse along the Ribbon of Office, it will be displayed in pieces are the reached mouse. This problem has been held regularly since the version 18.0.0 and persists in 18.0.1. I prefer not to minimize Firefox so I can move conveniently via Alt - Tab from Firefox and the other application, in that I work, but this problem that is almost impossible. FYI, when I'm in Firefox, no other pop application on top, not other applications show otherwise, so I know that the problem is caused by Firefox and/or interaction weird with the new version and installed plugins, drivers or other software.

    Could you try to disable graphics hardware acceleration? (I have trouble determining your "more system information" if it is enabled or disabled). As this feature has been added to Firefox, it has gradually improved, but there are still some problems.

    You need to restart Firefox for it to take effect, so save any work first (e.g. you compose mail, documents online that you are editing, etc.).

    Orange Firefox button or classic menu Tools > Options > advanced

    In the mini ' General' tab, uncheck the box for "use hardware acceleration when available.

    If you restart Firefox, the problem is solved?

  • Expression regular-not clear for the result

    I have written 3 applications using regular expressions, but I'm not very clear on the outcome. Looking for help to understand the logic.

    Here are the queries:

    1 > SELECT REGEXP_SUBSTR ('APT-101, BLDG 34, community xyz, XYZ ROAD, BANGALORE - 560066', '([[:alpha:]]+)') ADDR FROM DUAL;

    2 > SELECT REGEXP_SUBSTR ('APT-101, BLDG 34, community xyz, XYZ ROAD, BANGALORE - 560066', ' [[: alpha:]] +') ADDR FROM DUAL;

    3 > SELECT REGEXP_SUBSTR ('APT-101, BLDG 34, community xyz, XYZ ROAD, BANGALORE - 560066',(^'[[:alpha:]]+) ') ADDR FROM DUAL;

    All requests above returns the same result, i.e. 'APT '.

    Question: My understanding is:

    a > the regular expression [[: alpha:]] + represents one or more continuous occurrences of alphabets.

    b > parenthesis (i.e.) - represents the exact mactch

    c > carrot i.e. ^ represents the negation, that is to say. NOT (xyz)

    I can somehow convince myself that regular expressions - ' ([[: alpha:]] +)' and ' [[: alpha:]] +' in the given scenario may return the same string that is 'APT', but in the last query the regex ([[: alpha:]] + is preceded by ^, which according to my understanding should return something that isn't ONE or MORE CONTINUOUS OCCURRENCE OF ALPHABETS, but even this query is retune "APT".) Ask for help to understand this.

    Thank you

    Amrit Pandey


    Hi, Amrit,

    ba1fbc36-dd1f-46af-80EE-a9cedf91e344 wrote:

    I have written 3 applications using regular expressions, but I'm not very clear on the outcome. Looking for help to understand the logic.

    Here are the queries:

    1 > SELECT REGEXP_SUBSTR ('APT-101, BLDG 34, community xyz, XYZ ROAD, BANGALORE - 560066', '([[:alpha:]]+)') ADDR FROM DUAL;

    2 > SELECT REGEXP_SUBSTR ('APT-101, BLDG 34, community xyz, XYZ ROAD, BANGALORE - 560066', ' [[: alpha:]] +') ADDR FROM DUAL;

    3 > SELECT REGEXP_SUBSTR ('APT-101, BLDG 34, community xyz, XYZ ROAD, BANGALORE - 560066',(^'[[:alpha:]]+) ') ADDR FROM DUAL;

    All requests above returns the same result, i.e. 'APT '.

    Question: My understanding is:

    a > the regular expression [[: alpha:]] + represents one or more continuous occurrences of alphabets.

    b > parenthesis (i.e.) - represents the exact mactch

    c > carrot i.e. ^ represents the negation, that is to say. NOT (xyz)

    I can somehow convince myself that regular expressions - ' ([[: alpha:]] +)' and ' [[: alpha:]] +' in the given scenario may return the same string that is 'APT', but in the last query the regex ([[: alpha:]] + is preceded by ^, which according to my understanding should return something that isn't ONE or MORE CONTINUOUS OCCURRENCE OF ALPHABETS, but even this query is retune "APT".) Ask for help to understand this.

    Thank you

    Amrit Pandey

    Be careful.  Cut and paste the exact code you run.

    I do not get the same results for alI these queries.  I get an error message ' ORA-00936: missing expression. "for the 3rd.  Maybe you wanted to have the circumflex accent (^) inside the single quotes, like this:

    SELECT REGEXP_SUBSTR (' APT-101, 34 BLDG, community xyz, XYZ ROAD, BANGALORE - 560066' ")

    , ('^ [[: alpha:]] +')

    ) AS addr

    DOUBLE;

    a > you're right;

    [[: alpha:]] +.

    refers to a group of characters 1 or more adjacent, which are all letters of the alphabet.

    b > an expression can almost always be enclosed in parentheses free.  In other words, almost anywhere, you can use an expression

    x you can also use

    (x)               or

    ((x))                  or

    (((x))) and so on.  Each of them the same meaning.

    This has nothing to do with regular expressions.

    In expressions regular, curved brackets can be used for the Backreferences, for example \1 can be used to return to exactly what corresponded to the subexpression inside the 1st pair of parentheses.  You are not using anything like \1 here, so this backreferences do not apply to this question.

    c > sign means negation only when it comes immediately after [.]  For example

    SELECT REGEXP_SUBSTR (' APT-101, 34 BLDG, community xyz, XYZ ROAD, BANGALORE - 560066' ")

    ", ' [^ [: alpha:]] +"

    ) AS addr

    DOUBLE;

    product

    ADDR

    ------

    -101,

    in other words, the characters 1 or more consecutive which are NOT letters of the alphabet.

    Outside square brackets, the circumflex accent means the beginning of the string.

  • Query Sub behavior strange when using Expressions regular Oracle

    I met a strange "inconsistent" when you use an Expression regular Oracle with subqueries in SQL. Here are some details on how to reproduce what I have observed. We managed to find a solution to this "problem" using a database index; I'm writing this case hoping to better understand why Regular Expressions Oracle do not seem to work in the same way that the older, standard functions integrated as INSTR, SUBSTR, AS, etc..

    Environment settings:
    This test has been done using Oracle XE (GR 11, 2) on 32-bit Windows operating system. For my test, I used the HR schema (which is delivered pre-completed with the installation of this product) with some modifications of my own.

    Make the Test objects:
    create table hr.emp_test as
    select to_char(employee_id) as emp_id_char, employee_id as emp_id,
    first_name, last_name, hire_date
    from hr.employees;
    To illustrate my test, I inserted mixed alphanumeric values and a null value in the column of my emp_id_char for good measure:
    insert into hr.emp_test (emp_id_char, first_name, last_name, hire_date)
    values ('XKCD123','TEST','LASTNAME',sysdate);
    insert into hr.emp_test (emp_id_char, first_name, last_name, hire_date)
    values (null,'TEST1','LASTNAME2',sysdate);
    commit;
    * (1) this request fails once a nonnumeric value is inserted into the emp_test table.*
    with
       sub1 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date 
          from hr.emp_test  )
    select * from sub1
    where emp_id between 100 and 110
    * (2) this query works OK.*
    with
       sub1 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date 
          from hr.emp_test where emp_id_char not like 'X%'  )
    select * from sub1
    where emp_id between 100 and 110
    * (3) this query works OK.*
    with
       sub1 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date 
          from hr.emp_test where instr(emp_id_char,'X',1) = 0 )
    select * from sub1
    where emp_id between 100 and 110
    * (4) this query Fails.*
    with
       sub1 as ( select emp_id_char, first_name, last_name, hire_date
                   from hr.emp_test
                  where regexp_instr(emp_id_char, '[^[:digit:]]') = 0 ),
       sub2 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date
                  from sub1 )
    select *
    from sub2
    where emp_id between 100 and 110
    
    ERROR:
    ORA-01722: invalid number
    * (5) even down the results of the rational expression of 3rd under the query in sequential processing order also FAILS *.
    with
       sub1 as ( select emp_id_char, first_name, last_name, hire_date
                   from hr.emp_test
                  where regexp_instr(emp_id_char, '[^[:digit:]]') = 0 ),
       sub2 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date
                  from sub1 ),
       sub3 as ( select emp_id, first_name, last_name, hire_date from sub2 )
    select *
    from sub3
    where emp_id between 100 and 110
    
    ERROR:
    ORA-01722: invalid number
    * (6) that it does not like previous query as well *.
    with
       sub1 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date,
           regexp_instr(emp_id_char, '[^[:digit:]]') as reg_x 
           from hr.emp_test 
           where reg_x = 0),
       sub2 as ( select emp_id, first_name, last_name, hire_date, reg_x
          from sub1 where reg_x = 0 )
    select * from sub2
    where emp_id between 100 and 110
    
    ERROR:
    ORA-00904: "REG_X": invalid identifier
    Our Solution...
    Add a hint to the query of sup that 'hiding' the result of sub1 in memory. That did the trick. This suspicion resembles only viable workaround for this behavior. Other old built-in functions (INSTR, AS, etc.) an they were automatically following the execution plan (results of cache memory) that he had to use a 'hint' to force with the function of the regular expression.

    The conclusion, which is what I would like to help to understand or explain is that:
    If you create a series of queries/sup queries or inline views, values depend on "regular expression" type built-in sql functions do not seem to stick or maintain when implemented in complex query logic.

    Any idea is appreciated!
    Thank you!

    Published by: 870810 on July 6, 2011 15:47

    870810 wrote:
    I met a strange "inconsistent" when you use an Expression regular Oracle with subqueries in SQL.

    This is the expected behavior and has nothing to do with regular expressions - much less directly (I'll explain later). Main rule: there is no WHERE clause predicate order. Even if you use views, views online, subquery factoring, optimizer etc. can extend your display, display online, a subquery factoring. And it's Optimizer who decides the order of execution predicate unless you use the ORDERED_PREDICATES key. Now, I can explain. Regular expressions are powerful enough but also everywhere in life to pay for it with the higher cost of execution. That's why optimizer decides to apply emp_id between 100 and 110 first and regexp_instr (emp_id_char, "[^ [: digit:]]'") = 0 later.

    explain plan for
    with
    sub1 as ( select emp_id_char, first_name, last_name, hire_date
    from emp_test
    where regexp_instr(emp_id_char, '[^[:digit:]]') = 0 ),
    sub2 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date
    from sub1 )
    select *
    from sub2
    where emp_id between 100 and 110;
    
    SQL> @?\rdbms\admin\utlxpls
    
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------
    Plan hash value: 3124080142
    
    ------------------------------------------------------------------------------
    | Id  | Operation         | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |          |     1 |    57 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP_TEST |     1 |    57 |     3   (0)| 00:00:01 |
    ------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------
    
       1 - filter(TO_NUMBER("EMP_ID_CHAR")>=100 AND
                  TO_NUMBER("EMP_ID_CHAR")<=110 AND  REGEXP_INSTR
                  ("EMP_ID_CHAR",'[^[:digit:]]')=0)
    
    15 rows selected.
    
    SQL> 
    

    As you can see, optimizer uses a FULL SCAN to read data from the table and apply emp_id between 100 and 110 which translates TO_NUMBER ("EMP_ID_CHAR") > = 100 AND TO_NUMBER ("EMP_ID_CHAR")<=110. and="" obviously="" it="" fails="" trying="" to="" convert="" xkcd123="" to="" number.="" now="" cost="" of="" instr(emp_id_char,'x',1)="0" is="" lower="" and="" optimizer="" decides="" to="" apply="" instr="" first.="" therefore="" xkcd123="" is="" filtered="" out="" before="" to_number="" is="">

    SQL> explain plan for
      2  with
      3  sub1 as ( select emp_id_char, first_name, last_name, hire_date
      4  from emp_test
      5  where instr(emp_id_char, 'X') = 0 ),
      6  sub2 as ( select to_number(emp_id_char) as emp_id, first_name, last_name, hire_date
      7  from sub1 )
      8  select *
      9  from sub2
     10  where emp_id between 100 and 110;
    
    Explained.
    
    SQL> @?\rdbms\admin\utlxpls
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------
    Plan hash value: 3124080142
    
    ------------------------------------------------------------------------------
    | Id  | Operation         | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |          |     1 |    57 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP_TEST |     1 |    57 |     3   (0)| 00:00:01 |
    ------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------
    
       1 - filter(INSTR("EMP_ID_CHAR",'X')=0 AND
                  TO_NUMBER("EMP_ID_CHAR")>=100 AND TO_NUMBER("EMP_ID_CHAR")<=110)
    
    14 rows selected.
    
    SQL> 
    

    The bottom LINE: With the help of strings to store non-chaine (numeric in your case) is never a good idea and shows design problems.

    SY.

  • expression regular-insert to create a 'new' string expression in the correct position

    I have sample data in table T, and I sample how I want more than data output of the query output.
    with T as
    (
    select 'CREATE OR REPLACE PACKAGE BODY "YYY"."PACKAGEONE" IS' s from dual union all
    select 'Create or REPLACE PACKAGE BODY "ZZZ"."PACKAGETWO" IS' s from dual
    )   
    select REGEXP_REPLACE(T.s, '^.PACKAGE BODY$','(\1)_new',1,1,'i') as s from T;
    /*
    Expected output:
    CREATE OR REPLACE PACKAGE BODY "YYY"."PACKAGEONE_new" IS
    Create OR REPLACE PACKAGE BODY "ZZZ"."PACKAGETWO_new" IS
    */
    All data as a result of model:
    CREATE OR REPLACE PACKAGE BODY "[owner]"."[name]" IS
    Where [owner] can be any string. In the examples of data we have for example XXX and YYY values here.
    And [name] can be any string. In the sample data we have for example values PACKAGEONE and PACKAGETWO here.
    Other parts of the chain is fixed and rest as you see.
    In accordance with the request of expected results should replace substring '[owner] '. ' ' [name] ' '[owner] '. "" [name] _new.

    How can I write this query?
    I think that I have in some way should in regular expression counts the positions of double quotes to achieve the expected result, but I don't know how.
    SQL> ed
    Wrote file afiedt.buf
    
      1  with T as
      2  (
      3  select 'CREATE OR REPLACE PACKAGE BODY "YYY"."PACKAGEONE" IS' s from dual union all
      4  select 'Create or REPLACE PACKAGE BODY "ZZZ"."PACKAGETWO" IS' s from dual
      5  )
      6* select REGEXP_REPLACE(T.s, '"([^.]+\.[^.]+)"','"\1_new"') as s from T
    SQL> /
    
    S
    ----------------------------------------------------------------------------------------
    CREATE OR REPLACE PACKAGE BODY "YYY"."PACKAGEONE_new" IS
    Create or REPLACE PACKAGE BODY "ZZZ"."PACKAGETWO_new" IS
    
    SQL>
    
  • Outlook Express 6: replacement of the Archives after problem

    How can I replace/reinstate my archive after that my OE6 was corrupted and newly rebooted.

    Archive is saved completely (in .dbx) but I can't find the solution to make the message readable again in my OE!  Help!

    Outlook Express problems are dealt with elsewhere: http://social.answers.microsoft.com/Forums/en-US/xpnetwork/threads Russ Valentine

  • Expression to replace the image according to the text of the layer.

    Hello, I wanted to ask you is it possible to replace the image in the function composition text text layer. That is the text layer contains code # 34 and expression indicates what kind of image should be placed according to conditions in expression of image.

    Sincerely, Deimantas

    Hello

    Expressions can not add/replace images.

    All images must be here somewhere, in the form of layers in the model or in a precomp, but not only as items in the project Panel.

    Then you can play with the opacity of these layers, with an expression of opacity to each of them:

    textLayer = (pickwhip the text layer that transports information);

    If (textLayer.sourceText == thisLayer.name) 100

    0 otherwise;

    The condition can be something different, for example "if (textLayer.sourceText is thisLayer.index"), etc, etc.

    Not clear what should be this condition in your case.

    Xavier.

  • Validation of object Expression regular email address

    Hello

    Does anyone know of a regular expression, that I can use to validate an e-mail address field? I use Apex 3.2.

    Your help would be much appreciated.

    Thank you
    ca84
    ^((\s*[a-zA-Z0-9\._%-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4}\s*[,;:]){1,100}?)?(\s*[a-zA-Z0-9\._%-]+@[a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4})*$
    
  • expression regular {}

    Can you please explain the below two statement

    SELECT COUNT (*)
    OF THE DOUBLE
    WHERE REGEXP_LIKE ('670013432423615 ', '^(6700[0-9]{11,15}$)')

    SELECT COUNT (*)
    OF THE DOUBLE
    WHERE REGEXP_LIKE ('670013432423615 ', '^(6700[0-9]{12,15}$)')

    We do match and another does not.

    What is the diff?

    Hello

    2989211 wrote:

    Can you please explain the below two statement

    SELECT COUNT (*)
    OF THE DOUBLE
    WHERE REGEXP_LIKE ('670013432423615 ', '^(6700[0-9]{11,15}$)')

    SELECT COUNT (*)
    OF THE DOUBLE
    WHERE REGEXP_LIKE ('670013432423615 ', '^(6700[0-9]{12,15}$)')

    We do match and another does not.

    What is the diff?

    The difference is that the former has 11 where the second has 12:

    ' ^ (6700 [0-9] {11, 15} $) '

    ' ^ (6700 [0-9] {12, 15} $) '

    Both are looking for '6700' at the beginning of the string, followed immediately of N digits, and then the end of the string.  The only difference is N.

    In the first expression, N is a number between 11 and 15.  In this case, there are exactly 11 digits after '6700' in the string, so that it corresponds.

    In the second expression, N is a s number 12 and 15.  11 is not between 12 and 15, so it does not.

  • Regular expression for invalid number

    Hello world

    I use version oracle as follows:

    SQL > select * from v version $;

    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - production
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for 32-bit Windows: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

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

    I use a regular expression to replace invalid values in a table.

    I got oracle error 'ORA-01722 invalid number '.

    My query looks like this:

    SELECT DISTINCT

    MRC_KEY,

    PURPOSE_CD,

    RESIDENCE_DESC,

    TO_NUMBER (regexp_replace (ICAP_GEN_MADAPTIVE, "..?")) 0? 0? (\d+) [-.] ((?', '\1')) as ICAP_GEN_MADAPTIVE,

    Of

    MRRC_INT

    I don't know what are invalid values in the table, so I can write regexp accordingly.

    Any guidance is appreciated!

    Thanks in advance

    J

    Hello

    Whenever you have a problem, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.  View of the code which is not what you want can be useful, but there niot enough by itself.
    See the FAQ forum: https://forums.oracle.com/message/9362002

    Let's look at what you do:

    REGEXP_REPLACE (icap_gen_madaptive

    , '[+. ]' || -exactly 1 of these characters

    '?0?0?' || -up to 2 ' 0 '

    '(\d+)' || -some numbers (it comes to \1)

    '[-.]?'    -0 or 1 of these characters

    , '\1'

    )

    Is it really what you want?  A group of figures don't match, as the patten must start with a sign more, a point or a space.  You want to allow a decimal point at the beginning and at the end, as in "." 9. '?  If there are numbers before and after the decimal point, as in "1.2", you want only the digints before the comma?  You never said what you want, but I'm guessing that these are things that you don't want.

    If the pattern is found, this changes only the schema, so a string like "FU + 123 BAR" more than the model + 9 "" changed to "9" and the resulting string. "" "" FU9BAR"would be passed TO_NUMBER.

    If the pattern is not found, as in "FOO", nothing is changed, and the entire string is passed to TO_NUMBER.

    I suspect you want to use instead of REGEXP_REPLACE REGEXP_SUBSTR, or, if there is stuff to ignore before and/or after the number you want to include in the model, so that REGEXP_REPLACE will be replaced by nothing.

    This looks like a good argument to use the NUMBER of columns to store numbers.

  • Changeparticular the characters of a string using regular expressions...

    Hi all
    I'm writing a function using the function of expression regular oracles REGEXP_REPLACE but I could not succeed until now.

    My problem is as follows, I have a text in a column say "Scott Sdfdfs Sdfd" I want to replace all the s and S with X characters and make the text looks like "XdfXdf XdfdfX Xdfd".

    It is possible by using regular expressions in oracle?
    Can you give me some clue?

    Thank you
    select
      regexp_replace('sdfsdf Sdfdfs Sdfd',
                     's|S', 'X') Replaced
    from dual;
    
    REPLACED
    ------------------
    XdfXdf XdfdfX Xdfd 
    
  • Need of a regular expression

    Hi guys,.

    Let us say that I have given as ' Radha | Krishna | Sarma | 1. 2. I need a regular expression to replace all the pipes to the spaces, with the exception of those which has numbers on both sides. I tried a lot of things, but nothing seems to work.
    SQL> with t as
      2  (select 'Radha|Krishna|Sarma|1|2' col
      3  from dual
      4  )
      5  select regexp_replace(col, '(\|)[^1-9]+\1', ' ')
      6  from t
      7  /
    
    REGEXP_RE
    ---------
    Radha 1|2
    
    SQL> with t as
      2  (select 'Radha|Krishna|Sarma|1|2' col
      3  from dual
      4  )
      5  select regexp_replace(col, '[1-9]+(\|)[1-9]+\1', ' ')
      6  from t
      7  /
    
    REGEXP_REPLACE(COL,'[1-
    -----------------------
    Radha|Krishna|Sarma|1|2
    
    SQL>
    I even tried to replace all direct to space first, then replace the space between the numbers to lead again.

    Please let me know if you have any solution.

    See you soon
    Sarma.

    Hi, Sarma,

    You may need to do it in two steps: one to replace the hoses that come before everything except a number and another to replace the remaining tubes following anything except a number, like this:

    REGEXP_REPLACE ( REGEXP_REPLACE ( col
                        , '(\|)([^0-9]|$)'     -- pipe, nondigit becomes ...
                        , ' \1'               -- space, nondigit
                        )
                , '([^0-9]|^)(\|)'     -- nondigit, pipe becomes ...
                , '\1 '               -- nondigit, space
                )
    

    Sorry, I'm not a database now, so I can't test it.

  • Search for a string using "Game Plan" or "Regular Expression to Match."

    Hello

    I would use the 'game plan' or the vi "Expression regular game" simply because the products that provide these vi. The result that interests me is the substring 'after '. I want to be able to specify a "substring" and get everything after the substring of the input string. However, I'm getting all confused and/or watered upward when it comes to "regular expressions". Is there a way to create a "regular expression" which acts as a 'substring' to find within the input string?

    The substring is a path of partial directory that contains a colon, backslashes, etc. which are part of a directory path.  If some how the "regular expression" entry must ingnore all special characters and simply to understand if the substring in the string entry and give me 'all things' after the substring in the output of 'after the string.

    Use Regular Expression Match instead of match pattern; It's better.

Maybe you are looking for

  • Apple Watch display problem

    I have the problem since a few weeks now, after having used the watch for more than a day without turn it on, the screen turns into a blue light, but everything is still visible, but as I said, with a slight blue tint over everything. If I disable th

  • Satellite series A turn off for the game Command and Conquer 3

    Hi all This happened to me twice. While I was relax play skirmish Command and Conquer 3, computer laptop turns off suddenly. I was running an external power supply and the battery was full. What is even more strange, it was impossible to next turn to

  • Filmmaker will not import avi file

    I used to be able to import the files avi and making movies, but yesterday he gave me this message "C:\Users\Aimee\Pictures\Hayley Videos\Movie.avi could not be imported." I tried a few different avi files without success.  I'm not very computer savy

  • Receipt of message operating system not found in Vista

    My computer came with the operating system not found.  I can reinstall Windows Vista.  My problem is that I can't find my disk to reinstall.  Can I download this somewhere I have my product key code and all other pertinent info.  Help, please. * orig

  • How can I stop my Windows Firewall to block my printer

    My HP5610 all-in - one printer has decided to print surprisingly s-l-o-w. I went in solutions of HP printer and ran their diagnosis and they said everything-is-good. I went further in help to try to disable the windows firewall and then worked the pr