want to use regexp_replace in pl/sql to replace a string containing repeat them consecutive to a words

Hi Experts,

I want to use regexp_replace in pl/sql to convert a string containing consecutive repeat words have only one.

for example: "is my name and and I was waiting for waiting for what it" should be replaced by "is my name and I was waiting for it."

Thanks in advance

Gordon

A slight change '(\w+\S\W)\1+' )

Concerning

Etbin

Tags: Database

Similar Questions

  • Using regexp_replace

    Hello, I could use assistance in using regexp_replace to the following results:

    I have string: OUTLET_ID, RETAILER_ID that is stored in the variable v_pk

    I want to use regexp_replace to convert v_pk to * 'OUTLET_ID ' | "RETAILER_ID."

    Any ideas?

    Thank you

    Like this?

    SQL> SELECT ''''||REPLACE(REPLACE('OUTLET_ID, RETAILER_ID',' '),',',''' || ''')||'''' out;
    
    OUT
    ----------------------------
    'OUTLET_ID' || 'RETAILER_ID'
    

    John

    Published by: John Spencer, November 4, 2010 15:03
    Not fair, Frank types too fast, but glad to see we agree :-)

  • To remove data XML from XML using REGEXP_REPLACE tags

    Hello

    I try to use the SQL REGEXP_REPLACE function on a piece of XML, to remove the actual XML data from the weather. My ultimate goal is to end up with a list separated by commas to names of XML elements. In the first stage, I want to just pull all of the actual data.

    I tested the following query, and it initially appeared to work:
    SELECT REGEXP_REPLACE('>THIS IS A TEST<', 
                          '>([[:alnum:]]\s|\S)*<',
                          '><' ) AS test_result
      FROM dual;
    Unfortunately, when I applied it to a full XML string, it did not. Here is the query to test that I used:
    SELECT REGEXP_REPLACE('<ROW><TEST_ELEMENT1>123</TEST_ELEMENT1><TEST_ELEMENT2>THIS IS A TEST!</TEST_ELEMENT2></ROW>',
                          '>([[:alnum:]]\s|\S)*<',
                          '><') AS test_result
      FROM dual;
    I found myself with the following result:

    * & lt; LINE & gt; & lt; / LINE & gt; *

    What I was trying to a:

    * & lt; LINE & gt; & lt; TEST_ELEMENT1 & gt; & lt; / TEST_ELEMENT1 & gt; & lt; TEST_ELEMENT2 & gt; & lt; / TEST_ELEMENT2 & gt; & lt; / LINE & gt; *

    If you are reading this and you are a Posix regular expression guru, could you let me know exactly where I am going wrong? Regular expressions are not my strong point, but I would better go home.

    Hello

    For your final requirement, the 'commas list names of XML elements', what using XQuery with something like:

    SELECT xmlquery(
      'string-join( for $i in $d//*
                    return local-name($i), "," )'
      passing xmltype('123THIS IS A TEST!') as "d"
      returning content
    ).getStringVal()
    FROM dual;
    
  • How Question: want to use ADMN > > common > > country like ExtAtt LookUp

    On PLM4P v6116.

    We need to have an attribute extended around rummage sale and country of origin.  We want to use the Common > > list of countries as a search rather than create new lists.  We are unable to locate the list in the user interface.  Is it possible to do... for an environmental assessment to consume the country list table.  And further, after we enter the scripts to translate the country names in Chinese, we want the EAs to be aware of language.

    Is there any method to accomplish what we are trying to try?

    Thank you.  Best, Beckie

    You can run some scripts sql on your database to verify your data?

    1. Check if InternalLookupCategory is included in LookupCategories. Make sure that the value returned by the sql below contains "InternalLookupCategory", the default value is like ' ItemDO = CommonLookup, filter = class = "CustomLookupCategory" or class = "InternalLookupCategory", ItemPropertyList = pkid | Name | Category... ".

      • Select ConfigValues in commonLookupServiceManagers where ManagerID = "LookupCategories."
    2. Check if countries in the category is included in InteralLookupCategory. If no records are returned by following sql running, you need to add a.
      • Select * from commonLookups where category = 'InternalLookupCategory' and name = 'country '.

  • To delete the characters only at the beginning of a string using regexp_replace

    I want to be able to delete the characters in a string only until the first numeric value.  If it takes place after the digital, I want to keep them.

    "for example"AB1234' becomes '1234', 'AB1234C' becomes ' 1234 C.

    It might be also spaces and other types of characters at the beginning.  I tried this:

    Select

    regexp_replace ('ABC1234', ' [^ [: digit:]]').

    regexp_replace ('AB 1234',' [^ [: digit:]]').

    regexp_replace ('AB 01234',' [^ [: digit:]]').

    regexp_replace ('AB1234C', ' [^ [: digit:]]').

    regexp_replace ('^ 1234', ' [^ [: digit:]]').

    regexp_replace ('* #1234Z ',' [^ [: digit:]]')

    OF THE DOUBLE

    For all except "AB 01234' returned '1234' so it retains the digital.    For "AB 01234' it returns correctly '01234'

    The bad are those with a character after digital, for example "AB1234C".

    I know it I'm missing something here, can someone please help with this?

    Thank you

    SQL> with t
      2  as
      3  (
      4  select 'ABC1234' str from dual
      5  union all
      6  select 'AB 1234' str from dual
      7  union all
      8  select 'AB 01234' str from dual
      9  union all
     10  select 'AB1234C' str from dual
     11  union all
     12  select '^1234' str from dual
     13  union all
     14  select '*#1234Z' str from dual
     15  )
     16  select str
     17       , regexp_replace(str, '^[^[:digit:]]+') str_new
     18    from t;
    
    STR      STR_NEW
    -------- --------
    ABC1234  1234
    AB 1234  1234
    AB 01234 01234
    AB1234C  1234C
    ^1234    1234
    *#1234Z  1234Z
    
    6 rows selected.
    
  • Use of domains in SQL data Developer MODEL

    Hello

    I'm trying to understand how to use areas of Oracle SQL Developer Data Modeler. We use version 3.1.3.  before I used Toad Modeler where the areas are just a part of your main design.

    Modeler data Oracle has a different concept.

    Suppose that I am working on 2 models: DesignA and DesignB which include relational models.

    DesignA and design B must use areas, but the list of areas in A design is very different from design B.

    Default domain file is located on drive c:, where SqlModeler is installed. It is of course unacceptable, so I need to change the default system Type directory in preferences.

    And of course, I want to have directories different area's of DESIGN and DESIGN B.

    So when I opened design has then I changed the default directory Type system we'll tell x:\AAA.   Then I close A design open design B and change the default directory of x:\BBB system Type

    I checked records AAA and BBB and they have required XML files here: defaultdomains.xml, defaultRFDBSSites and so on...

    Now the questions:

    can I rename defaultdomains.xls to something like AAAdomains.xls?  Domain administration can change any file with any name field, but how do I associate some file field with my design?  My wish, when I opened my design, and then the domain file will be automatically opened.  Is this possible?

    If I open 2 designs in Sql Modeler and switch between corresponding designs and domain files then need to be changed automatically as well.  Currently, I shouldn't forget to change the default system Type directory each time when I switch templates.  It is the only way to deal with?

    Thank you

    Vitaliy

    Vitaliy salvation,

    to see which domain files are used, the simplest is to go into the administration of the domain,

    Add new domain and then check the drop-down list for the property 'areas file' box - used files appears.

    Keep in mind that in defaultdomains.xml areas are still part of the domain that is used in the design. If this file must be empty (containing only 'unknown' domain) If you want to work

    with areas of level design.

    Philippe

  • I used REGEXP_REPLACE to remove Scott. is it possible to delete all information on Scott and storage simultaneously using REGEXP_REPLACE...?

    I used REGEXP_REPLACE to remove Scott. is it possible to delete all information on Scott and storage simultaneously using REGEXP_REPLACE...?


    Select REGEXP_REPLACE (dbms_metadata.get_ddl('TABLE','EMP'), '("Scott")', ", 1, 0, 'i') twice;


    result:

    CREATE TABLE 'EMP '.

    (SELECT 'EMPNO' NUMBER (4,0) NOT NULL,)

    'ENAME' VARCHAR2 (10),

    VARCHAR2 (9) "JOB."

    "MGR" NUMBER (4,0).

    "SAL" NUMBER (7.2).

    "DEPTNO" NUMBER (2.0)

    ) PCTFREE, PCTUSED, INITRANS 40 10 1 MAXTRANS 255 NOCOMPRESS SLAUGHTER

    TABLESPACE 'USERS '.


    I want to:


    CREATE TABLE 'EMP '.

    (SELECT 'EMPNO' NUMBER (4,0) NOT NULL,)

    'ENAME' VARCHAR2 (10),

    VARCHAR2 (9) "JOB."

    "MGR" NUMBER (4,0).

    "SAL" NUMBER (7.2).

    "DEPTNO" NUMBER (2.0)

    )

    Hello.

    In fact, it's a Japanese forum here.

    I'm sorry, English is not good for me...

    According to the reference,.

    DBMS_METADATA

    The description of the parameter called SEGMENT_ATTRIBUTES, it is written like this.

    > If TRUE , include clauses attributes segment in the DDL. If FALSE , omit them. Default value is TRUE .

    Before you SELECT it, it's OK if you run the following.

    exec DBMS_METADATA. SET_TRANSFORM_PARAM (DBMS_METADATA. False SESSION_TRANSFORM, 'SEGMENT_ATTRIBUTES',);

    I hope you find it informative.

  • I want to use cfselect...

    Hi all

    I want to use cfselect to act as a parameter to query specific data. My questions are:

    1. What are the key words maximum can I choose?

    2. How can I get that on my action page to query multiple selections?

    E.g.

    < cfquery >

    Select *.

    FROM tablename

    WHERE dateprod = ' #FORM. Defect_Title #' or dateProd LIKE ' #FORM. "Defect_Title #

    < / cfquery >

    Does make sense? I get nothing when I try this when multiple selection or when I select one I get double this one.

    Thanks in advance,

    DJ Khalif

    It is really better to use the tag .  Otherwise you are potentially exposing your database to SQL injection attacks.

    P. S.

    There is no limit on how may items can be in a select statement that I know.  But most of the DBMS have a limit on how long an IN clause may be.  But I think that most modern databases have quite a large list.  If you do not speak of the hundreds or thousands of items, then you're probably OK.

  • Replace the value of property intellectual using regexp_replace

    Hi guys,.

    What is the best way to change to change the position of third of an IP address using regexp_replace?

    For example, to change 192.168.0.1 to 192.168.100.1


    Thank you
    Manuel Vidigal
    SQL>  select regexp_replace('192.168.0.1', '\d+', '100',1,3) ip from dual
    /
    IP
    -------------
    192.168.100.1
    
  • 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
    
  • Since Apple ridiculously decided to abandon the center of games tab of my friends in the game does not load automatically and I have to go to GC and click the circle of friends so he could load, MORE I wonder constantly if I want to use my game stored loc

    Since Apple decided to abandon the center of games tab of my friends in the game does not load automatically and I have to go to GC icon and tap the circle of friends so he could load several times, MORE we continue to request if I want to use my game stored locally or my stored GC game. I refuse to install iOS 10, because it means of course I won't be able to manually load the tab my friends and my losing my game completely. How can I fix it? Remove the Center game is the worst thing that Apple could have done, in my humble OPINION.

    You will not lose your game entirely. I have several games of game Center, and they work fine. And I understand the developer of a game that this game center continues to store the backup of your game.

    It's just that now friending is handled via the interface of the game. The only options that you have in iOS10 is to go to the settings panel in / log out of game center or remove all friends. And none of the games I play has updated so I can see how their friending works with iOS10.

    Beyond providing the basic interface, Apple seems to have turned all aspects of the social game on the games themselves.

    If you want to make Apple know how you feel, you can leave your comments via this form

    http://www.Apple.com/feedback/

  • I've updated to 10.0.1 IOS and the new messaging feature will not work on my phone.  Help, I really want to use invisible ink...

    I've updated to IOS10.0.1, and the new features of meassaging do not work. Help because I really want to use invisible ink!

    You're now sending the arrow and selecting invisible ink?

  • How can I DISABLE the module "signature" when I want TO use an older add-on?

    I the MAGNIFICENT Add on 1 - ClickWeather and now has a message on the 'signature' module Now... I DON'T want to use a product of INFERIOR quality such as suggested in the name of the add - on.

    I would use the add-on that I already have on my Firefox, 1-ClickWeather. So, how can I disable the 'signature' on an individual add-on module? It is said to "Act with caution", but it does not show Me the details of my time. I reinstalled the add-on, but it does not yet record my position.

    Yes, I KNOW it is no longer supported, but has always worked until this past Saturday. It was abandoned several years ago but was kept alive by a single poster whose comments have disappeared. I have the add-on on my computer. I continued to update the continuous Firefox updates. Now, I want to again but there's this ridiculous thing on the module "signature" and «proceed with caution...» »

    You cannot delete the warning, but in 42 Firefox extension should always work.

    See:

     Firefox 40-42: Firefox warns about signatures but doesn't enforce them.
  • what application would you recommend if I want to use my ipad as a second monitor for macbook please?

    What application would you recommend if I want to use my ipad as a second monitor for macbook please?

    http://www.ZDNet.com/article/Duet-display-turn-iPad-into-a-second-monitor-for-Ma c-to-zero-latency-review.

    It uses a wired connection of USP and so did not shift as applications that use wifi

  • I don't want to use icloud drive

    When I implemented this new mac I clicked together icloud drive. He then copied photos on the disk. I don't want to use the free space of 5 GB and I don't want the photos in the reader. I deleted it. I want to just make sure that the photos that I took in icloud drive will remain in my request for photos. They are on my computer, and I just copied them on the disc, right?

    You can disable everything in iCloud system preferences

Maybe you are looking for