regexp_substr: a regular expression for the separate comma operator of witn of string literals IN

The following regular expression separates simple values separated by commas (SELECT regexp_substr (: pCsv,'[^,] +', 1, level) FROM DUAL CONNECT BY regexp_substr (: pCsv, ' [^,] +', 1, level) IS NOT NULL); Exampple: 300100033146068, 300100033146071, 300100033146079 returns 300100033146068 300100033146071 300100033146079

This works very well if we use the regex with SQL IN operator select * from mytable where t.mycolumn IN (SELECT regexp_substr (: pCsv,'[^,] +', 1, level) FROM DUAL CONNECT BY regexp_substr (: pCsv, ' [^,] +', 1, level) IS NOT NULL);

But this query does not work if the comma-separated value is a single literal string 'one', 'two', 'three '.

Thanks for your reply. my request was mainly on regexp_substr.  Need to request was simple: any table with a column of varchar type can be used. Next time I'll give you an example.

All ways working answer for my question is is SELECT regexp_substr (: pCsv,'[^, "] +', 1, level) FROM DUAL CONNECT BY regexp_substr (: pCsv, ' [^,"] +', 1, level) IS NOT NULL

Tags: Database

Similar Questions

  • Regular expression for the format: 000-000 - 000000 000000

    Hi guys,.

    I need to validate the columns in a regular expression for the format of 000 000 - 000000 000000.

    For example - if the column contains a value such as "500 110 - 500044 000100" then it should return 'true' otherwise 'false. '

    Your timely help is well appreciated.

    Thanks in advance.

    Hello

    inDiscover wrote:

    Hi guys,.

    I need to validate the columns in a regular expression for the format of 000 000 - 000000 000000.

    For example - if the column contains a value such as "500 110 - 500044 000100" then it should return 'true' otherwise 'false. '

    Your timely help is well appreciated.

    Thanks in advance.

    If you want a regular expression

    REGEXP_LIKE (str

    {{' ^ {\d{3} \d{3}-\d{6} \d{6}$'

    )

    According to your needs.

    You don't need regular expressions for this.  It will be more efficient to use

    TRANSLATE (str

    '012345678'

    '999999999'

    ) = 999 999 - 999999 999999'

  • regular expression for the xml tags

    Dear smart people of the labview world.

    I have a question about how to match the names of xml text elements.

    The image that I have some xml, for example:

    Peter

    13

    and I want to match all of the names of elements, that is to say: no, son, grandson, age, regardless of any attribute have these items. There is a regular expression, I can loop, that can do this? (Something like "\<.+\> ". "") It is no good because it matches the entire xml string.) I'd really only two different expressions, one for the match start elements, e.g. and one for the correspondence of the elements, for example.

    Thanks for your help in advance!

    Paul.

    The site Of regular Expressions will be very convenient.

    They have some good tutorials on regexp with a demo of the XML tags:

    Here is a small excerpt:

    The regular expression <\i\c*\s*>matches an opening of the XML without the attributes tag corresponds to a closing tag. <\i\c*(\s+\i\c*\s*=\s*("[^"]*"|'[^']*'))*\s*>corresponds to an opening with a number any attributes. Put all together, <(\i\c*(\s+\i\c*\s*=\s*("[^"]*"|'[^']*'))*| i\c*)\s*="">corresponds to an opening with attributes or a closing tag.  (source)

    If you want advanced XML analysis I suggest JKI XML toolkit.

    Tone

  • Help in regular Expression for the beaches of limitation

    Hi, I'm working on the provision of a text field is limited to dates, it's just a part of the code. I already have the validation of the dates, but I am now limiting what the user enters using a regular expression. This code works a little however, it does not limit me for example I can enter more than 2 digits, but then he limits based on the total amount allowable so for example 8 digits are allowed if I just type. I need to stop after 2 digits then have a - then 2 other numbers then one - and then followed by 4 digits. I tried to limit each section and grouping as well. Any help would be greatly appreciated. Thank you.

    It is in the format code and I am the appellant in the key sequence.

    function DateKS () {}

    var value = AFMergeChange (event);

    If (! event.willCommit) {}

    Allow only characters that match the regular expression

    Event.RC = /^([0]{0,1}[1-9]{0,1}|[_1]{0,1}[012]{0,1}) ([-] {0,1}) ([0] {0,1} [1-9] {0,1} |) [12] {0,1} [0-9] {0,1} | ([3] {0,1} [01] {0,1}) ([-] {0,1}) ([0-9] {0,4}) $/ .test (value);

    }

    }

    I decided that control for 100 and 400 was not necessary because this event does occur that all 400 years. But I'm working on it further and changed even more. Here is my code to work.

    function isLeapYear (year) {}
    year return % 4 = 0;
    }

    function checkDaysInMonth (day, month, year) {}
    daysInMonth var = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

    If (month = 2) {}
    If (isLeapYear (year)) {}
    daysInMonth [1] += 1;
    }
    }

    return daysInMonth [month - 1] > = day;
    }

    function checkDateFormat (dateStr) {}
    var errorMsg = ",
    maxYear = (new Date()) .getFullYear (),
    minYear = maxYear - 1,.
    match = dateStr.match(/^(\d{2})-(\d{2})-(\d{4})$/),
    months,
    day,
    year;

    If {(matches)
    month = parseInt (matches [1], 10);
    day = parseInt (matches [2], 10);
    year = parseInt (matches [3], 10);

    If (month < 1="" ||="" month=""> 12) {}
    errorMsg = "invalid value for the month: ' + matches [1];"
    } ElseIf (day = 0) {}
    errorMsg = "invalid value for the day:" + match [2];
    } else if (! checkDaysInMonth (day, month, year)) {}
    errorMsg = "number of days for invalid month: ' + match [2];"
    } ElseIf (year < minyear="" ||="" year=""> maxYear) {}
    errorMsg = "invalid value for the year:" + match [3] + "-must be between" + minYear + "and" + maxYear;
    }
    } else {}
    errorMsg = "invalid date format: ' + dateStr + ' \r\nPlease use format: dd-mm-yyyy ';"
    }

    return errorMsg;
    }

    function checkReceivedDate() {}
    var value = AFMergeChange (event),
    errorMsg = ";
       
    ignore control if the value is blank, because this field is not mandatory
    If (! value) {}
    return;
    }

    If {(event.willCommit)
    errorMsg = checkDateFormat (value);

    If (errorMsg) {}
    App.Alert (errorMsg, 0, 0, "error");
    Event.value = ";

    Returns false;
    }
    } else {}
    Allow only characters that match the regular expression
    Event.RC = /^(?:0) [1-9]? 1 [012]?) ? -? ( ? : 0 [1-9] ? | [12] [0-9]? 3 [01]?) ? - ? 2? 0? [0-9] {0,2} $/ .test (value);
    Event.RC = / ^ \d{0,2}-?\d{0,2}-?\d{0,4}$/.test(value);
    }

    Returns true;
    }

  • Regular expression for the characters of perticular?

    Hello

    I use jdev 11.1.1.7

    I need to validate the input field

    1 length should be 10 characters (alpha neumeric)

    2 first 9 characters are numbers or alphabets. for example: 0123ac456

    3. last character only alpahbet and those are ("A' 'B' 'C', 'H' 'J', 'K', 'L'"S""T""V""X".)

    I write like this: ^ [0-9a - z ABCHJKLSTVX] {10,10} $

    But we must all alphabet in the last takes not mentioned the letters...

    any body can help me...

    Kind regards

    User.

    Try the following reg exp.

    ' ^ [0 - 9a - zA - z] {9,9} [ABCHJKLSTVX] {1,1} $".

    Timo

  • Regular expression for Dreamweaver

    I haven't had time to really become a professional when it comes to regular expressions, and unfortunately, I need one a conclusion it's hard wrap the head around.

    In a text file, I have hundreds of cases as follows:

    {Click here to visit my website} {} fromhttp://www.adobe.com/

    I need a regular expression for Dreamweaver that I can run in the window 'Search and replace' to switch the order of the above to:

    {http://www.adobe.com/} {click here to visit my website}

    Can someone provide some guidance? I'll be short due to my lack of experience with regular expressions.

    Thank you in advance!

    For Dreamweaver:

    {([{([Search: {([^)}] *)} {([^)}] *)}

    Replace: {$2} {$1}

  • Grouping and backreferences with regular expressions on the window to replace the text

    I'm really appreciate the inclusion of regular Expressions in the search and replace functionality. One thing miss me that East of backreferences in the replacement expression. For example, in unix tools vi or sed, I could do something like this:
     s/\(firstPart\) \(secondPart\) \(oldThirdPart\)/\2 \1 newThirdPart/g 
    that allow me to switch the places of first and secondPart and substitute totally thirdPart. If grouping and backreferences are already present in the window replace text, how do you properly call them?

    Published by: Justin.Warwick on August 23, 2011 08:26

    You can vote on the request for this to the exchange of SQL Developer, to add weight to the implementation as soon as possible: https://apex.oracle.com/pls/apex/f?p=43135:7:3693861354483465:NO:RP, 7:P7_ID:16761

    Kind regards
    K.

  • regular expression for LOV?

    I have a list of strings in a LOV. I tried filtering by typing in ' ^ disc "in the search bar, that I hope will return a list of strings starting with 'disc', but I failed.

    Any idea on how to use regular expressions for LOVs? Thank you!

    HI Buffalo,

    I have an element of the selection list in my named page1: P1_EMPNAME with the value of query lov

    Select ename, ename from emp WHERE EGEXP_LIKE(ename,:P1_SEARCH) r like as or: P1_SEARCH IS NULL

    I have a text box search in my page 1 name: P1_SEARCH

    When I run the page, by default all empnames appear in the lov list item
    I gave ^ bison in the element of text search and click on the button submit, it shows the buffalo employee in my lov point list.

    If you want all entries beginning with S, get ^ s
    Ends with R, use r$

    Please try this link http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28424/adfns_regexp.htm

    Thank you
    Logaa

  • regular expression for something that does not have a fixed sequence

    Hello

    Just having a little trouble with a regular expression. I have an input string and I want to find something that is not this string, so

    Input = Hello

    Match = Hello

    Football game? = False

    Entry = Hello1

    Match = Hello

    Football game? = False

    Input = Hello

    Match = goodbye

    Football game? = True

    As I thought that I understood it, to enter as a regular expression in the regular Expression.vi of Match would be ~ (Hello).

    If I understand as well, I can't do this by using the match pattern.

    Maybe you good people can correct me. Thank you!


  • How can I access the recipient "subordinate" in the expressions for the participant to ApprovalTask generator type "by the expression" value?

    Hello

    How can I access the recipient "subordinate" in the expressions for the participant to ApprovalTask generator type "by the expression" value?

    I can access some details of the beneficiaries of the workload, but how to access direct subordinates?

    TIA

    Leo

    Well, as I said, if you need to get a list of all rollover (for whatever logic you have), making calls to IOM to find the list of users whose Manager is the person in your composite.

    Sorry if I am wrong again.

  • Can I switch my academic license for CS5 Master Collection to a regular license for the same thing?

    Can I switch my academic license for CS5 Master Collection to a regular license for the same thing?

    If Yes, how much does it cost?

    I'm not allowed to resell my academic license as it is. So, I explore the most cost-effective way for me to get a full license for CS6.

    I understand that academic licenses at regular licenses upgrades do both in a new license which can be sold together. So, maybe it would be cheaper to spend an academic license for CS5 Master Collection to a regular license for CS5 Master Collection, that it would upgrade the software to a later version.

    My reason for the continuation of the full version is that I have upgraded my equipment a lot and don't like versions of the software upgrade, since it requires twice the same software installation. I would rather sell off the previous version and buy a full version. From my experience, this procedure usually ends the same, sometimes cheaper. But, above all, it makes the management of software much easier.

    What Bob says. You can only upgrade to current versions of Adobe products. Currently CS6.

    Your upgrade path is CS5 Master Collection Edu to CS6 Master Collection (upgrade) for US$ 1 049

    http://www.Adobe.com/products/creativesuite/MasterCollection/buying-guide-upgrades.html

    or join the creative cloud.

    My reason for the continuation of the full version is that I have upgraded my equipment a lot and don't like versions of the software upgrade, since it requires twice the same software installation.

    With Adobe software, you just have to install the latest version - even if it's an upgrade on a computer brand new with the previous installation of any Adobe software. Any upgrade of the discs and downloads contain full versions of the software. The installation program recognizes complete and updated versions to update via the serial number.

    So when installing version CS6 Master Collection on a brand new PC (no Adobe software) previous upgrade, you install only CS6.

    The CS6 installer will ask your CS6 serial number and will recognize that it is a series of upgrade. It will then ask a serial number for a longer early version. Which must be CS5 or CS5.5 due to the new political upgrade a back version of Adobe.

    You enter your serial number CS5 Edu and CS6 Setup will continue.

    However, you can find the creative cloud a better fit for you, especially if you're a frequent recovery plant.

    The cloud for you as an owner of CS5 will first be $29.99 US/month for the first 12 months. Then, he'll be back at full price (currently US$ 49.99/month).

    Keep in mind that if/when your Cloud membership expires or is cancelled, you lose use and access to the software. You will then return to CS5 Master Edu with no upgrade path. At this point, it's an all or nothing ask from Adobe.

  • Oracle regular expressions - splits the string into words for

    Hello

    Nice day!

    My requirement is to split the string into words.

    So I need to identify the new line character and the semicolon (;), comma and space like terminator for string entry.

    Please note that I am currently embedded blank and the comma as separator, as shown below.

    Select regexp_substr('test)
    TO
    string in words, "([^, [: blanc:]] +) (', 1, 1) double;"

    How to integrate the semicolons and line break characters in regular expression Oracle?

    Please notify.

    Thanks and greetings

    Sree

    This has nothing to do with REGEXP. Is SQL * more parser does not not a semicolon at the end of the line:

    SQL > select ' testto, mm\;
    ERROR:
    ORA-01756: city not properly finished chain

    SQL >

    Just break the chain:

    SQL > select regexp_substr ('testto, mm\;' |) '
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<= regexp_count('testto,mm\;'="" ||="">
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;' |') STRINGIN
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    Or modify SQL * more the character of endpoints:

    SQL > set sqlterm.
    SQL > select regexp_substr ('testto, mm\;)
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<=>
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;) STRINGINTOWO
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    SY.

  • regular expressions for numbers demical in a comma-delimited list


    I have a table that lists the details of the occupation of the sites of a comma-delimited list:

    create table tenure_test)
    number of site_number
    tenure_detail varchar2 (255));

    insert into tenure_test values (1, ' Crown (Other) (0.15 ha), private (555.25 ha)');
    insert into tenure_test values (2, ' private (5.76 ha)');
    insert into tenure_test values (3, ' private (0.18 ha, Crown (3.25 hectares), Indeterminate (Leased) (5.85 ha)');)

    What I want to do is to use a regular expression to calculate the sum only numbers in the tenure_detail column.

    For example, for site_number 1, it would be 0.15 + 555.25 = 555,4

    I also have another regular expression that has just the numbers in a comma-delimited list.

    For site_number 1: 0.15, 555.25

    I tried this:

    Select site_number, tenure_detail, regexp_substr (tenure_detail, "[0-9] + \.") ([0-9] {2}') under the name test1

    of tenure_test;

    but it lists only the first number.

    Hello

    996454 wrote:

    I have a table that lists the details of the occupation of the sites of a comma-delimited list:

    create table tenure_test)
    number of site_number
    tenure_detail varchar2 (255));

    insert into tenure_test values (1, ' Crown (Other) (0.15 ha), private (555.25 ha)');
    insert into tenure_test values (2, ' private (5.76 ha)');
    insert into tenure_test values (3, ' private (0.18 ha, Crown (3.25 hectares), Indeterminate (Leased) (5.85 ha)');)

    What I want to do is to use a regular expression to calculate the sum only numbers in the tenure_detail column.

    For example, for site_number 1, it would be 0.15 + 555.25 = 555,4

    I also have another regular expression that has just the numbers in a comma-delimited list.

    For site_number 1: 0.15, 555.25

    I tried this:

    Select site_number, tenure_detail, regexp_substr (tenure_detail, "[0-9] + \.") ([0-9] {2}') under the name test1

    of tenure_test;

    but it lists only the first number.

    Here's one way:

    SELECT site_number

    SUM (TO_NUMBER (REGEXP_SUBSTR (tenure_detail

    , "\d+\.\d*" - see Note 1

    ) T

    LEVEL

    )

    )

    ), Total

    OF tenure_test

    CONNECT BY LEVEL<= regexp_count="" (="">

    , '\d+\.\d*'

    )

    AND PRIOR site_number = site_number

    AND PRIOR SYS_GUID () IS NOT NULL

    GROUP BY site_number

    ;

    Output:

    TOTAL OF SITE_NUMBER

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

    1 555,4

    2 5.76

    3 9.28

    Note 1: what exactly makes a 'number '?  I'm assuming it's 1 or more digits, followed by a comma, followed by 0 or more numbers.  You can have a slightly different definition; in this case, change the arguments 2nd REGEXP_SUBSTR and REGEXP_COUNT.

    I guess also that site_number is unique.  If not, you will have to change the CONNECT BY and GROUP BY clauses, to refer to something (or a combination of things) which is unique.

    Relational databases are designed for each column of each row contain 1 single piece of information, not a list delimited with a variable number of elements.  It is so basic to the design of database he called the first normal form.  If your first followed table form normal, this query (and many other queries that involve that table) would be much simpler to write, more efficient to run and less likely to have bugs.  See if you can normalize this table.  Any effort that you have to spend now to normalize the table will pay very quickly.

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.

    Don't forget to tell what version of Oracle you are using.  I tried the query in Oracle 11.2 above.  You may need to CONNECT BY a little differently in earlier versions, and REGEXP_COUNT will not work in Oracle 10.

  • 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.

  • regular expression - get the numbers from a string

    Hello world

    I'm trying to use regular expressions to get all the numbers in a string. The only problem is that the chain can vary.

    For example:

    It's my rope 3 and 8 I want 2 get out of those 7 numbers
    Random text 9 with 5 for everyone weekend 8

    How can I do?

    Thanks in advance :)

    Quote:
    Posted by: Scott Stroz

    #numbersOny #.

    Who will be only to crush all the numbers in a large number.

    The attached code will return a nice list of numbers.
    Though the numbers may contain commas or decimal points, the code can easily be adjusted

Maybe you are looking for