Reg: Regular Exp - help

Hi Experts,

I need help to use the regular Expression-

WITH t AS)

SELECT ' 1234 Angel Villa, House 420 | Detroit | WE | 700129' double txt

)

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

SELECT

txt,

SUBSTR (txt, InStr(txt,'||') + 2, (INSTR(txt,'|',1,3)-INSTR(txt,'||')-2)) val1,

REGEXP_REPLACE (txt '([^ ||] *||) (.*)', '\2') val2

T;

I want to extract the text entry "Detroit" - going between the two. (begins - with that) and a. (ends - with that).

txt - 1234 Angel Villa, House 420 | Detroit | WE | 700129

val1 - Detroit

val2 | Detroit | WE | 700129

My regex is not appropriate somewhere. Please provide any suspicion in this regard (and not the exact solution - want to try)

The backreference is very interesting but am very bad at writing regular expressions. Help much appreciated.

Thank you and best regards,

-Nordine

(on Oracle 11.2.0.3.0 - Exadata)

Published:

Tried this now.

REGEXP_REPLACE (txt '([^ ||] *||) ([^|] *) (|. *)', '\2') val2

Output-

||||

Nordine Hello B

Yes, because you have more sign like | in this case you must use the non-greedy option for your star: *?

I would use the REGEXP_SUBSTR.

You must use the escape character \ and must be given to the * that you don't want to have the sign | Once again...

It's a little hard to explain. If you want the solution tell me.

Best regards, David

P.S.: Because nobody didn't read you just wish that you do not want to have the right solution only just advice... And you already know the solution, so I post my solution too

WITH t AS)

SELECT ' 1234 Angel Villa, House 420 | Detroit | WE | 700129' double txt

)

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

SELECT

txt,

SUBSTR (txt, InStr(txt,'||') + 2, (INSTR(txt,'|',1,3)-INSTR(txt,'||')-2)) val1,

REGEXP_REPLACE (txt '([^ ||] *||) (.*)', '\2') val2

REGEXP_SUBSTR (txt '(\|) {2} ((.| ^(\|)) *?) (\|)', 1, 1, NULL, 2) LIKE REGEXP_RESULT --> Chris227 Correction

T;

Where:

(Results): take this sign | but don't interpret as the OR operator.

(\|) {2}: take the sign. twice

.           : Take any character

. *: Take among these characters, as you can

.*?         : Take one of these characters, not the longest chain you will find (NON-greedy option:?)

(.*?)       : Consider backreference in parentheses. REGEXP_SUBSTR last option is 2, because we want only the name of the city without sign.

Last (-|)   : The name of the city must be accompanied by a sign.

I hope it helps.

The SQL above has been fixed-> reason: Chris227 noticed a mistake. Thanks Chris277!

Tags: Database

Similar Questions

  • Get a BSOD on shutdown fairly regularly - need help troubleshooting - even a cardboard open :(

    Hello!

    I hope that I might be able to get troubleshooting tips the BSOD I seem to now on a regular basis.  I guess it's maybe a USB driver problem, but I don't know how to understand this.  Here are the details I received after the most recent BSOD reboot:

    Signature of the problem:
    Problem event name: BlueScreen
    OS version: 6.1.7601.2.1.0.256.1
    Locale ID: 1033

    More information about the problem:
    BCCode: 9f
    BCP1: 0000000000000003
    BCP2: FFFFFA8004F0F3C0
    BCP3: FFFFF800035183D8
    BCP4: FFFFFA8005322850
    OS version: 6_1_7601
    Service Pack: 1_0
    Product: 256_1

    Files helping to describe the problem:
    C:\Windows\Minidump\093015-5881-01.dmp
    C:\Users\Alan\AppData\Local\Temp\WER-8923-0.SysData.XML

    Read our privacy statement online:
    http://go.Microsoft.com/fwlink/?LinkId=104288&clcid=0x0409

    If the online privacy statement is not available, please read our offline privacy statement:
    C:\Windows\system32\en-US\erofflps.txt

    I am pleased to provide you with any information that might help identify the culprit and any support are really appreciated...

    These accidents were related to the corruption of memory (probably caused by a driver).

    Run these two tests to check your memory and find which driver is causing the problem.  Launch auditor.  You don't need to run memtest again unless the auditor is not the cause, or you want to.

    If you are overclocking anything reset by default before running these tests.
    In other words STOP! If you don't know what it means that you're probably not  


    1-Driver Verifier (for full instructions, see our wiki here)

    2-Memtest. (You can learn more about running memtest here)
  • I have somehow lost my tab bar. It contains tabs that I use regularly. Help.

    With Windows 10, I had a horizontal bar at the top which held in tabs, I want to use regularly. This horizontal bar set of tabs disappeared, as well as the button to reveal the legs of overflow (which had no place on the horizontal bar).

    First of all - what I did to lose who together bar and second why is so amazingly difficult to bring?
    I don't know about groups of tabs. I'm not interested by this at this time.

    Other toolbars are visible?

    If no: Make sure that Firefox is not in his view full screen. The F11 key toggles between normal display and full-screen.

    If Yes: The bookmarks toolbar can be turned off. You can use one of the following methods to display the toolbar list and activate the desired bars it:

    To enable the bookmarks toolbar, bar of menus or other bars, click it in the list.

    Does it work?

  • Since I installed Firefox, I get CONSTANT security alerts 'expired certificate' when I go to most any website, even those I visit regularly. Help!

    Please see my original question above. Since I switched from IE to Firefox, I can't even to view Aetna medical claims. Even YOUR help site, had a notice of upcoming certificate expired and I had to click through the tabs 'override' to continue. I get "Security alert" for security certificate expired on almost every single website, that I will. I just keep clicking on 'Yes' when asked do you want to continue. It's horrible. I tried to use a page I found that told me to go to tools, then Options, then Web features to 'Allow sites', but it doesn't have the choice to click on «web feature»

    Just to be sure, check your calendar system date as it could be not current and some previous year or such.

  • regular expression help

    Hello

    I have a string I want to use a regular expression to avoid a cascade of matching patterns, but I can't seem to make it work.

    The string:

    ^ XA ~ TA000 ~ JSN ^ LT0 ^ TEM ^ MNW ^ MTT ^ PON ^ PMN ^ LH20, 0 ^ JMA ^ PR4, 4 ^ MD0 ^ JUICE ^ LRN ^ CI0 ^ XZ
    ^ XA ^ LL0076
    ^ PW376
    ^ 25, 25 ^ FT25, 38 ^ BXN, 2, 200, 0, 0, 1
    ^ FH\ ^ FDP1000 ^ FS
    ↑ FT0, 56 ^ A0N, 20, 20 ^ FH\ ^ FDP1000 ^ FS
    ^ FT180, 65 ^ A0N, 42, 40 ^ FH\ ^ FD ^ FS
    ^ 25, 25 ^ FT150, 38 ^ BXN, 2, 200, 0, 0, 1
    ^ FH\ ^ FDP1001 ^ FS
    ↑ FT120, 56 ^ A0N, 20, 20 ^ FH\ ^ FDP1001 ^ FS
    ^ FT180, 65 ^ A0N, 42, 40 ^ FH\ ^ FD ^ FS
    ↑ PQ1, 0, 1, O ^ XZ

    I want to get out there is one instance of:

    P1000

    P1001

    In this example. The numbered part will be different for the other channels, like P4567, PA34554, etc. He will never vary from P or PA. The section number can be 4 or 5 digits.

    Each of these appear twice in the chain.

    The regular expression, I tried to use is:

    \^FD*\^FS

    and then I was going to eliminate duplicates.

    And now my brain doesn't give up.

    Tay

    This vi retrieves all P followed by numeric characters.  You need to change to include AP

  • Regular expression help please. (extraction of a subset of the string between two markers)

    I haven't used regular expressions before, and I can't find a regular expression to extract a subset of the string between two markers.

    The chain;

    Stuff of header I want
    Stuff of header I want
    Stuff of header I want

    Stuff of header I want
    Stuff of header I want
    Stuff of header I want

    6 ERRORS
                         
    Info I want to line 1
    Info I want line 2
    Info I want line 3
    Info I want to line 4
    Info I want to line 5
    Info I want line 6
    END_ERRORS

    From the string above (it is read from a text file), I try to extract the subset of string between ERRORS 6 and END_ERRORS. The number of errors (6 in this case) can be any number from 1 to 32, and the number of lines I want to extract will correspond with this number. I can provide this number of a caller VI if necessary.

    My current solution, which works, but is not very elegant;

    (1) using Match Regular Expression for the return of the string after you have synchronized the 6 ERRORS

    (2) uses the Regular Expression matches to return all characters before game END_ERRORS of the string returned by (1)

    Is there a way this can be accomplished using 1 Regular Expression Match? If so someone could suggest how, as well as an explanation of the work of the given regular expression.

    Thank you very much

    Alan

    I used a character class to catch any word or whitespace characters.  This put inside parentheses a substring matching the criteria that you can get by developing the node for regular expression matching.  The \d matches the numbers and the two * s repetition of the previous term.  So, \d* will find the '6', as well as "123456".

  • Regular exp support

    Hello

    I want to search using regexp_like for field values that start with REC_AE or REC_

    Field of table values

    'REC_AE_TMPL_GEN '.

    'REC_TMPL_GEN '.

    I tried SELECT * FROM MODEL WHERE REGEXP_LIKE (category, ' ^ REC_(AE|??)) STAT ') but it does not work.

    Help, please

    Try this: ^ REC_ (AE_)? STAT

  • Reg: regular expr doubt-

    Hi Experts,

    I have a doubt of simple query. A play with regular expressions and assigning independent assignments.

    with t as (txt)

    (

    Select 'my name is Vanessa and a good buoy' from dual UNION ALL

    Select "nordine Bolduc" dual UNION ALL

    Select 'a' out of two

    )

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

    Select

    txt,

    REGEXP_COUNT (txt, '(\w)?', 1, 'i') count_of_chars,-< <-doubt (1)

    REGEXP_COUNT (txt,'(\w) + ', 1,' i') count_of_words,.

    WW REGEXP_COUNT (txt,'(\w) *', 1, 'i'), - < <-doubt (2)

    Length (txt) length_of_string

    t;

    TXT COUNT_OF_CHARS COUNT_OF_WORDS WW LENGTH_OF_STRING

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

    my name is Vanessa and a good buoy 33 8 16 32

    ranit biswas                                 13              2          4               12

    a                                             2              1          2                1

    Doubts:

    (1) why is there a mismatch of County between columns 2 and 5 IE count_of_chars and length_of_string?

    Difference in number is 1.

    This is the beginning (^) or end ($) character, which is counted?

    Why 2) (\w)* difffer so to (\w)+ ?))

    Am I missing some basic notion? Please notify.

    Thank you and best regards,

    -Nordine

    (on Oracle 11.2.0.3.0 - Exadata)

    Hello

    nordine B wrote:

    ...
    SQL > select regexp_replace ('faaafbabaffab','([ab]*) ', '<\1>') double val;

    VAL
    -----------------------------
    <>f<>f<>f<>f<>

    Here, is: whenever a character does not match with any character in the set match ([ab] here), looks like a character before it?

    So, the first character has been verified that is 'f' because it does not, a '<>' was placed before the "f".

    What is the internal work?

    You will find perhaps clearer to imagine a pointer that can be placed before or after the characters, from before the first character after the last character and to check if the model is on the right.

    When the pointer is before the 1st character, there is 0 the or BS on his right, so replace you these 0 characters with '<>' and increments the pointer.

    When the pointer is after the 1st character, but before the 2nd character, there are 3 has the right, if you replace these 3 characters with ', and move the pointer to the end of these 3 characters.

    ...

    When the pointer is between 11 and 12 characters, there are 2 a and b to the right, if you replace these 2 characters by '' and move the position of the pointer 2 to the right.

    When the pointer is after the 13 character (in other words, the last character), there is 0 a or b to his right, so replace you these 0 characters with '<>',

  • regular exp

    Hi all

    I expect only "ABC" combination in the string if I have other that the combination of the CBA, I do this line with the null value

    I use oracle 11.2 (Toad)

    WITH t1
    DID (1 SELECT ID, "ABCD" DOUBLE STR
    UNION ALL
    SELECT 2, 'ABC' OF THE DOUBLE
    UNION ALL
    SELECT 3, 'A' OF THE DOUBLE
    UNION ALL
    SELECT OPTION 4, 'B' OF THE DOUBLE
    UNION ALL
    SELECT 5, THE DOUBLE ' C'
    UNION ALL
    6 SELECT, HAD "DOUBLE
    UNION ALL
    SELECT 7, "AD" OF THE DOUBLE
    UNION ALL
    SELECT 8, 'AE' OF THE DOUBLE
    UNION ALL
    SELECT 9, "BC" OF THE DOUBLE
    UNION ALL
    SELECT 10, "AC" TO DOUBLE)
    SELECT *.
    FROM t1


    EXPECTED

    ID str

    1
    2 ABC
    3A
    4 B
    5 C
    6

    7
    8
    9 BC.
    10 AC

    Thanks in advance

    Hello

    849776 wrote:

    Hi all

    I expect only "ABC" combination in the string if I have other that the combination of the CBA, I do this line with the null value

    I use oracle 11.2 (Toad)

    WITH t1
    DID (1 SELECT ID, "ABCD" DOUBLE STR
    UNION ALL
    SELECT 2, 'ABC' OF THE DOUBLE
    UNION ALL
    SELECT 3, 'A' OF THE DOUBLE
    UNION ALL
    SELECT OPTION 4, 'B' OF THE DOUBLE
    UNION ALL
    SELECT 5, THE DOUBLE ' C'
    UNION ALL
    6 SELECT, HAD "DOUBLE
    UNION ALL
    SELECT 7, "AD" OF THE DOUBLE
    UNION ALL
    SELECT 8, 'AE' OF THE DOUBLE
    UNION ALL
    SELECT 9, "BC" OF THE DOUBLE
    UNION ALL
    SELECT 10, "AC" TO DOUBLE)
    SELECT *.
    FROM t1

    EXPECTED

    ID str

    1
    2 ABC
    3A
    4 B
    5 C
    D 6
    7
    8
    9 BC.
    10 AC

    Thanks in advance

    Why do you want to be ' id = 6?  Why not NULL?

    Depending on your answer, you could get the desired results more effectively without regular expressions.  For example:

    SELECT id

    CASE

    WHEN LTRIM (str, "ABC") IS NULL

    THEN str

    END as str

    FROM t1

    ORDER BY id

    ;

  • Reg: With the help of several tables of facts in the RPD!

    Hi all

    Can I get help with the following scenario?

    We use OBIEE 11 g.
    We have a report that uses 1 single fact table to retrieve data and it must be hell a lot of time to display the data in the report.

    My question is is there a way to show the performance of the report if divide us the data in table 1 to 2 fact tables and the report uses them 2 made tables.
    Are there other ways of finalization of the report for better performance.

    Thanks for the help in advance!

    Ajay.

    Hi Ajay,

    Follow these steps for tuning;
    1. try to adjust the SQL query generated first by the report, and then make the necessary changes. (Put index on the column that is required so that your query is scanning the index instead of the whole table)

    2. you can try to create the agg fact table and use agg navigation to improve performance. (This is to reduce the data set on which sql is triggered)

    3. you can try to create partitions on the table of FACTS in the comic book, and so held the partitions are queried according to the filters.

    4. in the last if all the foregoing does not resolve your query, you can try to divide the FACT table in two or more depending on your decision and then use fragmentation content in the MDB of the RPD layer if it will strike appropriate tables depending on whether you declare.

    Mark Correct/utile so this can help.

    Good luck
    Kashi

  • Regular expression help numbers

    Hello

    I want an exact match of 9 digits or 12 digits, my query should give "No Match found" because the input value is actually 10 digits

    Select case when regexp_like (regexp_replace (' 123 4567 890 ',' '), ' ^ ([0-9] {9}) |) () [0-9] {12}) $')
    then Match "found."
    another "No Match Found"
    end test
    Double;

    Need help, I have to do something about something very basic, bad.

    Kind regards
    Ash

    Remove the 2 brackets:

    SQL> select case when regexp_like(regexp_replace( ' 123 4567 890', ' ' ), '^([0-9]{9}|[0-9]{12})$')
      2  then 'Match Found'
      3  else 'No Match Found'
      4  end as test
      5  from dual;
    
    TEST
    --------------
    No Match Found
    
    SQL> select case when regexp_like(regexp_replace( ' 123 4567 89', ' ' ), '^([0-9]{9}|[0-9]{12})$')
      2  then 'Match Found'
      3  else 'No Match Found'
      4  end as test
      5  from dual;
    
    TEST
    --------------
    Match Found
    SQL> 
    
  • How to move the hard drive to external hard drive backup and how to make the backup automatically and regularly

    Original title: EVOLUTION of BACKUP

    I SAVED IT ON THE HARD DRIVE TO PUT IN PLACE TO ENSURE THE GUARD. NOW, I HAVE A LIL BOX IS AN EXTERNAL HARD DRIVE, I GUESS. I GOT IT FOR THE MEMORY, LIKE A BIG THUMB. SAYS ITS NEED F HOW TO BACKUP IT (MY LAPTOP) THIS AUTOMATICALLY AND REGULARLY. HELP PLEASE, THANK YOU?

    Hello

    You can try the following methods and check if it helps.

    Method 1: Change where you back up your files
    http://Windows.Microsoft.com/en-us/Windows-Vista/change-where-you-back-up-your-files

    Method 2: Set up or change automatic backup settings
    http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-or-change-automatic-backup-settings

    Reference:
    Back up and restore: frequently asked questions:
    http://windows.microsoft.com/en-US/windows-vista/Back-up-and-restore-frequently-asked-questions

    Backup your files: http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-your-files

  • Help, please! CHKDSK stuck at step 4 of 5-6% for more than 90 minutes. If it is frozen? What can I do?

    Not very intuitive with the hard disks, disks, partitions, etc.  A friend told me I should be defragging my computer frequently to help it work better.  Then, I looked at steps to defragment and learned to run chkdsk first before you defragment.  I clicked on properties, tools, scheduled chkdsk for my C drive, checked the boxes ("automatically fix file system errors" and "Scan for and attempt recovery of bad sectors") and rebooted my computer to run the chkdsk command.

    Here is what my screen said during the last 90 minutes:

    The type of the file system is NTFS.
    volume label is PRESARIO.

    A disk check has been programmed. Windows will now check the disk.

    CHKDSK checks the files (stage 1 of 5)
    (deleted and corrupted files verification of such complete record)
    CHKDSK is checking the indexes (stage 2 of 5)
    (same as step 1... full check)
    CHKDSK is recovering lost files
    CHKDSK checks the security descriptors (stage 3 of 5)
    Security descriptor complete check.
    CHKDSK checks Usn Journal
    Audit of the USN Journal is complete.
    CHKDSK is verifying file data (stage 4 of 5)
    6 percent completed.

    And that's where he lives.  My computer is frozen?  I hear the tour runs every so often, as I work with something, but does not change the 6%.  I'm afraid to turn it off in the middle of DSKCHK but I don't know what else to do.  Help, please! I have windows XP Home Edition.  I had problems with my PC freezes in the past, but I usually just choose a restore date and it solves the problem for a while.  I had no need to restart in a while, I just wanted to start to defrag regularly to help the pc normally elapse.

    "PLEASE HELP!" I have windows XP Home Edition. »

    XP forums:

    http://social.answers.Microsoft.com/forums/en-us/category/WindowsXP

    Link above is for XP Forums.

    There is a list of the different Forums XP to the link above to help you.

    You get the help you need there.

    Here is the Vista Forums.

    See you soon

    Mick Murphy - Microsoft partner

  • Problem with &lt; b &gt; htmlText tag!

    Hello

    I have a problem with htmlText in AS3. I create in the font library. Regular and a "BOLD" of NeoSans version and export for actionscript. The < b > tag works, but the problem is that when I do it on my project, the police is not sharp and ugly but if I do the same step by step as3 empty of police project looks just great. I don't know what makes a difference. Please help me.

    I post images. I tried to create the same box htmltext in a different place in my project and fonts there seems too perfect. Only in the movieclip that I want to put my htmlText police don't is not look like that should look like (not sharp and ugly like the screen). I have no idea why it looks like this, in this one movieclip.

    PS Sorry for the bad English.

    use css to do this:

    var css:StyleSheet = new StyleSheet();

    "BOLD" var: Object = new Object();
    Bold.Color = "#000000";
    bold.fontFamily = new Yourboldfontclass (.fontName);

    regular var: Object = new Object();
    Regular.Color = "#000000";
    regular.fontFamily = new Yourregularfontclass (.fontName);

    css.setStyle (".reg", regular);
    css.setStyle (".bold", "BOLD");

    var tf:TextField = new TextField();
    tf.embedFonts = true;
    tf.styleSheet = css;
    addChild (tf);
    tf.htmlText = "Ut accumsan urna lobortis, and ullamcorper diam dictum vitae." Nullam ultrices, massa sit amet tincidunt dignissim, feugiat sem odio, nec, quam restore augue commodo eros massa. Pellentesque elementum lectus enim accumsan blandit mi. In volutpat imperdiet tincidunt. Surpassing in purus sit amet tempus auctor lectus auctor magna varius. CRAs hendrerit metus, sit amet orci faucibus eget bibendum ultricies. Proin ut odio nisl. Etiam nisi justo, ornare in, ultrices a, auctor id nulla. Mauris dictum aliquet sapien, sed dapibus enim tempor eget. Aenean tincidunt viverra nulla sollicitudin tincidunt sodales AC Vivamus imperdiet leo in ultricies vehiculasapien dolor. Integer adipiscing fitness Hall. « ;

  • declare the variable

    I started warning after running this code.
    He says that this line variable has no type declaration.
    What should I do? This is the code-->

    I suggest you break it down and focus on the creation of the table of the lines before trying to move on as follows

    var myText:String = myText.text
    var myTextArr = myText.toString().split(/[\r\n]/g)
    trace (myTextArr.Length) / / should give you a count of all rows...

    / [\r\n]/g - is a regular exp that looks like for each newline character in the string that was created programmatically using \r to represent the newline

    You can also try variations of the rational expression until you get the number of rows, that you expect.

    / [\r\n]{1,2}/g - resembles a minimum of 1 and a maximum of 2 line breaks

    As a beginner, you have a hard work in front of you, I know it can get frustrating but trial and error is the search of google and way only for examples. Sample analysis weblogs out there he wrote too much already, a lot of developers is the willingness to help but little do not have the time to write the code for you. I recommend you read about regular Expressions too that they are an essential part of any directory of programmers

Maybe you are looking for