helps the regexp_replace - converting numbers to strings

I try to use regexp_replace replace all occurrences of the type (number) (in brackets with a number inside) with the expression ('number') (add "before and after the number, and by here - to transform the number to varchar).

I can't find a way to do it properly.

It would be great if you guys could help out me here.

Example-

Before change: abcde (737) (6) s (v) sbsgs37

After change: abcde('737') s sbsgs37('6') (v)

Thank you

Ilya Golosovsky.

("Select REGEXP_REPLACE (' abcde (737) (6) s (v) sbsgs37 ', '\((\d+)\) ', q '[('\1 ')]')

of qry

Result:

ABCDE('737') s sbsgs37('6') (v)

q "[.. '] is called a string q, it allows us to embed single quotes in string literals without having to get away from them."

\((\d+)\)

  • ------(corresponds to the character (literally
  • 1 capturing group (\d+)
    • \d+ matches a digit [0-9]

      • Quantifier: + between one and unlimited times, as many times as possible, giving necessary [greedy]
  • \) corresponds to the character) literally

('\1')

  • 1 capturing group ("\1")

    • literally "corresponds to the character.
    • \1 matches the text even more recently matched by the capturing group 1
    • literally "corresponds to the character.

Tags: Database

Similar Questions

  • Helps the REGEXP_REPLACE

    Hello Experts

    I'm unable to analysis at the address below. Please see the part of the desired effect.
    Please help solve this problem. I have tried the REGEXP_REPLACE but could not obtain the success.

    Is the version of Oracle, I'm working on that

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
    With partitioning, OLAP, Data Mining and Real Application Testing options

    Thank you

    RB

    with table1 as
    * (by selecting '1805SOUTHETHELAVE' addr1 throughout Union double *)
    Select '1165MCALLISTERRD' addr1 Union double all the
    Select '2161COMMERCCDR APT206' addr1 Union double all the
    Select '1048HARPERLEEDR' addr1 Union double all the
    Select '20021NWCR4290' double addr1
    *)*

    looking for a SOLUTION AS

    * 1805 SOUTHETHEL AVE *.
    * 1165 MCALLISTER RD *.
    * 2161 COMMERCC DR. *
    * DR. HARPERLEE 1048 *.
    * 20021 NWCR 4290 *.

    Hello

    Here's one way:

    SELECT     addr1
    ,     REGEXP_REPLACE ( addr1
                     , '(\d+)([[:alpha:]]+)(AVE|DR|RD|\d+).*'
                     , '\1 \2 \3'
                     )     AS new_addr1
    FROM    table1
    ;
    

    Output:

    ADDR1                 NEW_ADDR1
    --------------------- ----------------------------------------
    1805SOUTHETHELAVE     1805 SOUTHETHEL AVE
    1165MCALLISTERRD      1165 MCALLISTER RD
    2161COMMERCCDR APT206 2161 COMMERCC DR
    1048HARPERLEEDR       1048 HARPERLEE DR
    20021NWCR4290         20021 NWCR 4290
    

    He gets good results of the sample data, but he could get good results for the wrong reasons. I have no way of knowing, since I do not know the reasons why you want to get the results that you do. Explain exactly what you're trying to do. Depending on what you want, you might need nested functions.

  • Is it possible to convert numbers to strings of text?

    I was wondering if it is possible?

    As a design feature, I would have (automatic) page numbers represented as text.

    Is it possible a number of automatic script page in a text string. I visualize the page down/left page numbers to have with the text running vertically in a separate text box.

    1. one

    22 - twenty two

    234. two hundred and thirty-four

    AAMT

    Steve

    HA - sorry. The line

    frame.parentStory.appliedFontSize = 8;

    should be

    frame.parentStory.pointSize = 8;

    to work properly with enough modern ESC.

  • You can script "convert numbering to text.

    I have a very large group of files that I need to convert numbering to text on. I built my own scripts for a little while now to do a lot of repetitive functions, I need to do but I'm still learning. I can't figure out how to put in a script of the function "convert numbering to text. Can someone point me in the right direction? Thank you

    app.activeDocument.stories.everyItem () .convertBulletsAndNumberingToText ();

    Repeat this for

    app.activeDocument.stories.footnotes, tables, etc.

  • Help for a date and time string in the format of get-date

    When you take a date / time string of an object:

    The format of the entry is a string and get-date doesn't seem to be able to convert to the

    a System.DateTime.

    I want to compare this value to 30 days so there are get-date ((get-date).adddays(-30))

    When I try the following, it seems to work then import it:

    (get-date - UFormat "%d/%m/%Y %T" ("2010-06-30 00:00:00" ""))

    If I add the following:

    "[datetime]" (get-date - UFormat "%d/%m/%Y %T" ("2010-06-30 00:00:00" ""))

    He can't convert it.

    Without the datetime component, when I try a superior test uses only the date

    the part as well:

    $Test = '2009-10-06 00:00:00.

    If ($Test - gt (get-date - UFormat "%T"("06/05/2010 00:00:00") %d/%m/%Y ""))

    {

    $Tested = 'Yes '.

    }

    On the other

    {

    $Tested = 'no '.

    }

    $tested

    Results in a Yes tentatives being earlier.

    In the script it returns all records where the date is after

    as 05 and ignore the year, month, and time.

    Any help with this would be greatly appreciated.

    Thank you

    This has to do with the 'culture' that you use in your PowerShell session.

    You can use the Get-Culture cmdlet to see that one you use.

    If you try

    [datetime](get-date -UFormat "%m/%d/%Y %T"("30/06/2010 00:00:00"))
    

    The parameter - UFormat produces a string and

    the cast is expected default mm/dd/yyyy format, for the part of the date.

    So, by reversing the month and day of your UFormat string - that has been corrected.

    BTW, I have attached the line because the SW forum do not have hooks.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Is there a way to differentiate the string containing the characters and numbers?

    Hello, I created an application to read data from a serial port device. The problem is that the device, at startup, displays a block of text that contain characters describing the device. Shortly after, he displays a command prompt "command:" it's when I want my VI to enter the command to start to take action.

    I was looking at the VISA waiting on the event and looks that could be used to wait for the output device, only a "Serial character", but there is no distinction between the letters and numbers that I can tell.

    If the device is out of numbers in the reading string, of course, no need to enter the command to start to take action once again, which will probably only confuse the device. In this case, I want my VI to continue taking measures with VISA Read.

    The reason is that when I run the application, the device may have already been turned on. Send this command to the device using VISA Write is not necessary at this time.

    Any advice would be appreciated. Thank you.

    This makes it much easier.  In this case, this will do the trick.  You will notice that the bottom of the case does not match even if it has valid values inside.  The only thing that will match if the entire string is of the form XX. XXXX. Incidentally, since we are only matching numbers now, you can remove the "ignore case" Boolean as there is more important.

  • Cannot convert abcd of the type class java.lang.String interface java.util.List

    Hello

    I get an error of "cannot convert the class type abcd java.lang.String interface java.util.List" where "abcd" is a string in a listbox.

    and my code is something like this

    < af:selectOneListbox id = "lstcatg" label = 'List of categories' partialTriggers = 'proud '.

    value = "#{viewScope.RegWoComp.lstboxcatg}" >

    < f: selectItems id = value="#{viewScope.RegWoComp.customList}"/ "lstselect1" >

    < / af:selectOneListbox >


    bean

    private list < String > lstboxcatg;

    {} public void setLstboxcatg (List < String > lstboxcatg)

    This.lstboxcatg = lstboxcatg;

    }

    public List < String > getLstboxcatg() {}

    Return lstboxcatg;

    }

    public BindingContainer {} getBindings()

    Return BindingContext.getCurrent () .getCurrentBindingsEntry ();

    }

    Private Sub button (ActionEvent actionEvent)
    {
    JUCtrlListBinding listBindings = (JUCtrlListBinding) getBindings () .get (lstboxcatg);
    Object [] str = listBindings.getSelectedValues ();

    for (int i = 0; i < str.length; i ++)

    {

    System.out.println (STR [i]);

    }
    }

    I tried to use this fact.

    object str = listBindings.getSelectedValue ();

    System.out.println (STR);

    and here, if I change the data type of lstBoxcatg

    private String lstboxcatg;

    {} public void setLstboxcatg (String lstboxcatg)

    This.lstboxcatg = lstboxcatg;

    }

    public String getLstboxcatg() {}

    Return lstboxcatg;

    }

    can I get a nullpointerexception on line object str = listBindings.getSelectedValue ();

    No you can use this code you don't use link layer

    remove this code. You will get the selected value in this string variable

    Just write this about you button action and verification.

    System.out.println (selectedVal);

    Ashish

  • I downloaded the latest version of the DNG Converter Camera Raw version 9.1.1 for windows. However, I get error install the update saying "error opening file for writing. Also on my help menu updates is not active?

    I downloaded the latest version of the DNG Converter Camera Raw version 9.1.1 for windows. However, I get error install the update saying "error opening file for writing. Also on my help menu updates is not active?

    If the installation program itself fails to open and run. Download it again maybe your current download is corrupted. Also, what OS you are using and you are an administrator with permission to install.

  • need help to get the value using the REGEXP_REPLACE function.

    I am trying to extract the value placed between "< listitems >... < / listitems >" but I am unable to get these value using the REGEXP_REPLACE function.
    select REGEXP_REPLACE('<InputParameters></ParamSet><listitems>14545454</listitems></ParamSet></InputParameters>'
    ,'(<InputParameters>.*<listitems>)(.*)(</listitems>.*<InputParameters>)'
    ,'\2') from dual;
    required output:
     1454554
    Can someone please help me achieve this goal.

    Hello

    You forgot the / before the last InputParameters. If fix you that, your code will work.

    Here is a slightly different way:

    SELECT  REGEXP_REPLACE ( '14545454'
                     , '^.*?(.*?).*$'
                     , '\1'
                     )     AS listitems
    FROM    dual
    ;
    

    Least to type, the less likely you will have to make typos.
    If there are 2 (or more) elements of listitmes, 1 will be returned.

    From Oracle 11.1, you can also use REGEXP_SUBSTR. I have Oracle 10.2 avaialable now, so I can test the following, but I think you'd say:

    SELECT  REGEXP_SUBSTR ( '14545454'
                     , '(.*?)'
                     , 1
                     , 1
                     , NULL
                     , 1
                     )     AS listitems
    FROM    dual;
    

    When it comes with the text that is or looks to, XML, consider using XML functions.

  • I want to convert the double data type to string type

    I want to convert the double data type to string, have idea about that

    Hello

    Use f

    FN: String (ARG) returns the string value of the argument. The argument can be a number, boolean, or node-set element

    Example: string (314)
    Result: "314".

    http://w3schools.com/XPath/xpath_functions.asp#string

    See you soon,.
    Vlad

  • I did the error page numbering; need help please

    CS4 IND, win7. I have a file with the pump and the price of parts and another with a fair price for parts. Starting price on page 1 of the pump (the cover page, the left side of page 2... etc.) up to page 48. Similar agreement with parts price file. Today I created a book file, so I can make a pdf and search for the reference numbers in the two files and make sure that they have the same price in both files. Now, I have discovered that the second file (price of parts) in the book begins its numbering of pages to 50. I want to be like the first file numbering page. (like before I did this book file.) I dibbed in absolute numbering of the sections and make me lost and frustrated. How can I get the things as they were before? Help, please.

    In the 'book page numbering options' accessible via the menu:

    Uncheck the box that says automatically update section and page numbers.

  • can someone help me to convert the code in labview 5.1 in labview 8.5

    Hi, can someone help me to convert attached labview V 5.1 VI into a labview 8.5 VI?

    Thanks in advance.

    Altaf

    Here you go

  • I downloaded the DNG Converter and nothing happened. Help, please?

    I downloaded the DNG Converter and nothing happened. I checked my file download and when I click the marked file DNG, still nothing.
    Any idea what the problem may be? Thanks in advance!

    What os?

    This file (name and extension) have you downloaded?

    What is the file size?

    What version you are trying to use?

  • Help needed to convert ActionScript 3 for HTML5 javascript

    I'm looking for help conversion code actionscript 3 in javascript for a platform of HTML5.  I'm a developer flash by trade but I am not familiar on how to 'translate as js code.  I had recently downloaded CC animate, thinking that he take the existing .fla file and republish on a html5 format.  Well I was wrong.  All of my code that I used in flash gives me hundreds of errors & I have not even know where to begin. the question I have is: all my flash documents I created over the years must now be converted to html5.  Where do I go, who can help you? is there an easy way to do this? is there an online converter...  I need help! Thank you.  Here's an actionscript exsisting code that I need to convert: sorry for the copy and past of the script.

    ActionScript code below

    Stop();

    import flash.utils.Timer;

    Here comes the string of numbers (rootLoader.parameters)

    var generatedNums:String is MovieClip (parent.parent). WinningNumbers;

    creates an array of numbers generated

    var chosenNums:Array = generatedNums.split("-");

    convert text to numbers

    var n = chosenNums.length;

    While (n)-{}

    chosenNums [n] = Number (chosenNums [n])

    }

    / / call funtion to remove 0 from the list of numbers

    function remove(list:Array,callback:Function):Array {}

    for (var i: int = list.length - 1; i > = 0; i--) {}

    {if (! callback (list [i]))}

    List.splice (i, 1);

    }

    }

    back list;

    }

    remove the 0 from the list of numbers

    function removeCallback(item:Number):Boolean {}

    return item > = 1;

    }

    Remove (chosenNums, removeCallback);

    keeps track of what element of the array to use to create balls

    (first and second and third)

    var chosenNumsIndex:uint = 0;

    creates array of the coordinates of the numbers on the card.

    var kNum:Array = new Array();

    var bottomArray:Array = new Array ("", "", "", "", "", "", "", "", "", "","", "","", "","", "","", "","", "","" ");

    kNum [0] is a dummy, because there is no 0 to the Board of Directors.

    kNum [0] = {x: 0, y: 0};

    /

    Array of movieclips

    var mcArray:Array = new Array();

    mcArray.push (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, no. 23, n24, n25, no. 26, no. 27, no. 28, n29, n30, n31, n32, n33, n34, n35, n36, n37, n38, no. 39, no. 40, n41, n42, n43, n44, n45, n46, n47, no. 48, n49, n50, n51, n52, 53, n54, n55, n56, no. 57, n58, n59, n60 n61 n62, n63, n64, F65, no. 66, n67, n68, n69, n70, n71, n72, n73, n74, n75, n76, n77, n78, n79, n80);

    creates a timer that executes every 3 seconds.  Number of times it runs

    is determined by the length of the array of chosenNums (which corresponds to the number

    selected numbers)

    var: timer = new Timer (3000, chosenNums.length);

    Timer is tuned to itself trigger, calls chuckBall()

    timer.addEventListener (TimerEvent.TIMER, chuckBall);

    timer.addEventListener (TimerEvent.TIMER_COMPLETE, ballChuckingComplete);

    chuckBall generates coins

    function chuckBall(event:TimerEvent):void

    {

    generates the new coin - currency is the name of MovieClip in the library

    don't forget to export for Actionscript

    var c1:Coin = new Coin();

    coin is placed in the appropriate x and y coords

    C1.x = kNum [chosenNums [chosenNumsIndex]] .x;

    C1.y = there kNum [chosenNums [chosenNumsIndex]];

    addChild tells the main timeline to display the piece once it is generated.

    this.addChild (c1);

    trace (chosenNums [chosenNumsIndex])

    Pull the movieclip appropriate off-table and play to darken.

    mcArray [chosenNums [chosenNumsIndex] - 1] () .play;

    fill the low numbers

    chosenNumsIndex increments for the next time chuckBall works

    He draws the element next to the chosenNums table.

    chosenNumsIndex ++;

    bottomArray [chosenNumsIndex - 1] = chosenNums [chosenNumsIndex-1];

    trace ("value bottomArray" + bottomArray [chosenNumsIndex]);

    firstWinningNumB.text = bottomArray [0];

    twoWinningNumB.text = bottomArray [1];

    threeWinningNumB.text = bottomArray [2];

    fourWinningNumB.text = bottomArray [3];

    fiveWinningNumB.text = bottomArray [4];

    sixWinningNumB.text = bottomArray [5];

    sevenWinningNumB.text = bottomArray [6];

    eightWinningNumB.text = bottomArray [7];

    nineWinningNumB.text = bottomArray [8];

    tenWinningNumB.text = bottomArray [9];

    elevenWinningNumB.text = bottomArray [10];

    twelveWinningNumB.text = bottomArray [11];

    thirteenWinningNumB.text = bottomArray [12];

    fourteenWinningNumB.text = bottomArray [13];

    fifteenWinningNumB.text = bottomArray [14];

    sixteenWinningNumB.text = bottomArray [15];

    seventeenWinningNumB.text = bottomArray [16];

    eighteenWinningNumB.text = bottomArray [17];

    nineteenWinningNumB.text = bottomArray [18];

    twentyWinningNumB.text = bottomArray [19];

    var lastNumber:Timer = new Timer (60000: 1);

    lastNumber.addEventListener (TimerEvent.TIMER, lastNumDone);

    lastNumber.start ();

    chosenNumsIndex increments for the next time chuckBall works

    He draws the element next to the chosenNums table.

    chosenNumsIndex ++;

    }

    function ballChuckingComplete(event:TimerEvent):void

    {

    trace ("ballchuckingcomplete is working");

    var thirtySeconds:Timer = new Timer (15000: 1);

    thirtySeconds.addEventListener (TimerEvent.TIMER, thirtyDone);

    thirtySeconds.start ();

    }

    function thirtyDone(event:TimerEvent):void

    {

    trace ("thirty seconds to the top");

    Stop();

    gotoAndStop (2);

    }

    function lastNumDone(event:TimerEvent):void

    {

    trace ("last number completed");

    twentyWinningNumB.text = chosenNums [19];

    }

    fill the low numbers

    manually, start the timer.

    Timer.Start ();

    The severe and simple truth is that you will have to re - write everything from the beginning in JavaScript (aka ECMAScript).

    The good news is that JS syntax and functions are 99% identical to AS2. Transition to AS3 will be slightly more difficult due it it is a little more similar to Java.

    The bad news is that all the APIs are completely different. Flanimate in canvas mode uses CreateJS for all rendering, animation and preload. Another thing is the basic JS functionality, or it either library third you import yourself.

    For example, instead of:

    var thirtySeconds:Timer = new Timer (15000: 1);

    thirtySeconds.addEventListener (TimerEvent.TIMER, thirtyDone);

    You would do:

    var thirtySeconds = this.setTimeout (thirtyDone, 15000);

    And instead of trace(), you must use console.log (), since all code must run in a web browser.

  • Replace the free-standing characters in String

    In Oracle 10.2, I want to convert the string '1 2 3 4 5 6 def abc' to 'abc def '.

    Here is the code:

    1 with t as (select '1 2 3 4 5 6 def abc' double val)
    2 * Select regexp_replace (val, ' (\s[0-9]\s)+ ',' ') t outval)
    SQL > /.

    OUTVAL
    ---
    2 4 6 dembront

    It seems that the REGEXP_REPLACE performed only one iteration of the replacement. Is there a way to get the output string 'abc def' without going through several iterations?

    Hello

    Welcome to the forum!

    Here's one way:

    SELECT     REGEXP_REPLACE ( val
                     , '((^|\s+)[0-9])+(\s|$)'
                     , '\3'
                     )     AS outval
    FROM    t
    ;
    

    The problem with your initial request was that space after a freestanding figure can count as a space before another freestanding figure, but the same character cannot be used to satisfy two different matches.
    The query above does not replace undividual
    groups of 3 characters "\s[0-9]\s"; It replaces a variable number (1 or more) of
    ] "groups of 2 characters, but only when the last of them is followed by an another \'s." (Acutally, I modified the problem a bit to account for several space characters before or after each free-standing figure and also to eliminate the freestanding numbers at the beginning or end of the val.) If you don't want these changes, it is easy to modify the above query).

Maybe you are looking for