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.

Tags: Database

Similar Questions

  • 4.0 ai2 - automatic adjustment does not properly in the result of the query grid

    Hello

    in 4.0 ai2 automatic adjustment does not work in the result of the query grid.

    Rather than shrink the columns to the narrower size taking into account topics and content (see 3.2), it auto ' enlarged to fit the entire grid of data query.

    She looks worse and makes it harder to see results at a glance.

    Bug and will be fixed for the release of v4.

  • What type of certificates are not suitable for the signature of the extensions to HTML5?

    It is not clear to me, of the literature exactly what types of certificate are not suitable for the signature of the CC2014 HTML5 extensions.

    I used a Thawte 'Adobe Air' certificate for signing extensions based on Flash. It is now expired. Can I buy the same type and that will work cross-platform for the signature of the extensions to HTML5?

    See http://www.thawte.com/code-signing/content-signing-certificates/adobe-air/index.html

    Thank you

    Hi meeky2,

    Required certificates have not changed for HTML5 extensions, so the same type of certificate that you had before work ('Adobe Air' certificates are very good).

    Note that if you only distribute your HTML5 extension through modules Adobe / Adobe Exchange, then there is no need to use a paid certificate. If you distribute your extension elsewhere, then you should do the same thing as you did with the extensions of the AIR.

    Best regards

    Fraser

  • all rows in the table are not eligible for the specified partition

    SQL > Alter Table ABC
    Exchange 2 Partition P1 with Table XYZ;

    Modified table.

    SQL > Alter Table ABC
    Exchange 2 Partition P2 with Table XYZ;


    P2 Partition Exchange with XYZ Table
    *
    ERROR on line 2:
    ORA-14099: all rows in the table are not eligible for the specified partition

    The exchange partition works fine for the first time. However, if we try to swap the 2nd partition it gives the error.
    How to solve this error?
    How can I find the lines which are not qualified for a specific part. is there a query to find out the same thing?

    >
    Well, exchange of syntax and logic is not clearly as it should (IMHO). There is no element of syntax that tells Oracle we want to Exchange partition data in a table that is not partitioned or not partitioned into partition table data.
    >
    What? Not sure where you got that but maybe it was before you had first cup of coffee? ;)

    An "Exchange", it's just that; an Exchange. Partition data end up in the non-partitioned table and vice versa. It is meaningless and totally obsolete if "we want Exchange partition data in a table that is not partitioned or not partitioned into partition table data".
    >
    It was decided by Oracle not partitioned table control. If the non-partitioned table is empty, it means you want to Exchange data partition in a non-partitioned table. And if not partitioned table is not empty, it means you want to Exchange data in the table that is not partitioned into partition.
    >
    There is no decision to make. The segments are swapped. Oracle doesn't check, know or even care if one or the other or both segments are empty. 'Control' which is carried out (by default except if NO CONTROL is used) only consists of ensuring all the data in the segment intended for the partition belongs to this partition.

    It is what gives the example of John. This can NEVER work if table1 is empty unless p1 is empty at the beginning:
    1 Exchange p1 with table1
    2 Exchange p2 with table1

    As John explains, assuming that no other operations are trying to put the data from p1 P2 which is not possible if p1 actually contains data.

    You can save it for next April 1!

  • Don't want to wait for the results of the query

    Hello world.

    I'm on CF 7 and SQL Server 2005.

    I call a procedure stored through my CF code. The process can potentially take an hour or two to run. I would like the proc run on SQL Server, but don't want my page of FC wait for the results before we continue, I want just the code that follows the proc will run while the database server do it is something silently in the background. Is it possible to do this?

    Thank you

    You could try to create a job that calls your long-term stored procedure. In the CF, call the sp_start_job system stored procedure to start your work. I think sp_start_job returns at the start of the task, not when the work is complete, but you will need to test this.

    http://msdn.Microsoft.com/en-us/library/ms186757 (SQL.90) .aspx

  • Recently downloaded version 9.0.1 and the url is not valid for the default home page. The default home page is still supported?

    I currently have www.google.com set as my homepage, but Firefox says that the url is not valid for the default home page.

    The problem is now solved with the current version of Firefox 10.0. Thanks for the help ccbrunt and SafeBrowser.

  • Your device is not eligible for the unlocking Bootloader

    I use bike E 1 st Gen India. I want to unlock my bootloader. I went to the motorola Web site. When I entered the code he said that your device is not eligible for the unlocking Bootloader. I contacted the people at motorola, but they led me here. So please I ask to help me in this regard.

    Hi, ShaashwathBhat

    Please do not start new threads before searching for existing threads on the same topic. It causes congestion on the site and makes it harder for us to follow a folder. There are already a long discussion on this here, please post here. Thank you.

    Fence wire

    Best regards
    SUNY
    Motorola support

  • Tried to use iTunes to restore iPhone 5s, but the 17 error happens: "this device is not eligible for the requested build". No problem to enter the mode of recovery, apple server and the internet. Help?

    I tried to use iTunes to restore my iPhone 5s, but the 17 error happens: "this device is not eligible for the requested build". No problem to enter the recovery mode, connection to the apple Server (the software update download was complete) and internet connection. Help? I do an Apple store to restore?

    Error 17 refers to network problems. Take a look at these articles and try the suggestions:

    Solve the iOS update and restore error in iTunes - Apple Support

    Get help with iOS update or restore errors - Apple Support

  • Error: The system does not license for the OS image. The system cannot find the path specified

    Hello

    I copied the image of Windows Embedded 7 T510 using HP thin client capture on a USB port. Now, I'm trying to load this image in an another thin client Embedded Win 7 T510 via a USB port.

    However, when the customer starts using this image of the USB, I get error below.

    "Error: the system does not license for the OS image! The system does not have the specified path.

    What solutions do you recommend.

    Thanks in advance

    Solution:

    I tried to install it on a Linux Thin client... Is there had this error.

  • The server of the DNA is not reesponding for the wireless

    The server of the DNA is not reesponding for the wireless which is the steps to solve the problem?

    The server of the DNA is not reesponding for the wireless which is the steps to solve the problem?

    Where do you get your DNS addresses from?   For example, use nslookup or ipconfig/all

    In fact, let's try this:

    for /F "delims =: tokens = 1 *" %i in (' ipconfig/all ^ |) " find "DNS Se" ') do nslookup %j %j

    (Copy and paste that in a cmd window).

    HTH

    Robert Aldwinckle
    ---

  • My genuine Window Vista could not search for the new update, or errors are: Code 80073712

    My genuine Window Vista could not search for the new update, or errors are: Code 80073712

    If you forget to say 'thank you '?

    Description of the update of the system for Windows Vista tool
    http://support.Microsoft.com/kb/947821

    0 x 80073712 ERROR_SXS_COMPONENT_STORE_CORRUPT component store is in an inconsistent state.

    TaurArian [MVP] 2005-2010 - Update Services

  • Problems with sound and Audio - realtek hd audio is not compatible for the audio device

    I use Windows XPand receives my sound and audio to work, I got a lot of response to this problem, but not the right answers, I got my sound set correctly but my audio does not work. In my default audio device is defined as realtek hd audio that is not compatible for the audio device, I tried to remove it without any success because I don't know what else can be done to solve this problem. I did an update can also be found a update driver for my sound card in windows. I also run microsoft fixi it and said that my default audio device is wrong, I tried to change, but nothing seems to work. Before that my computer was working fine and now all of a sudden nothing works. Everthing is up-to-date on my computer except the I'm having problems. all I ask you, how can I removed realtek hd audio since I graduated from the audio device by default.

    Thanks for a quick reply.

    Hello

    You will remember to do recent changes to the computer before the show?

    I suggest you to download and install the latest driver audio realtek for Windows XP from the link and check if the problem occurs:

    http://www.Realtek.com.tw/downloads/downloadsCheck.aspx?langid=1&PNid=24&PFID=24&level=4&Conn=3&DownTypeID=3&GETDOWN=false

  • T610 with Windows Embedded 7 - the system does not license for the operating system image

    Hello community,

    I bought a refurbished computer ThinClient T610 that is running a Windows 7 Embedded English. The label on the package says, that the computer ThinClient is allowed with W7E. When I now run Easy Tools installed on the computer ThinClient hp to create a USB Image with the German language, everything works fine: the image is downloaded from the web and put on the stick.

    But after you start the stick, the installation program tells me: "the system does not license for the operating system image. What I am doing wrong? The BIOS is already the latest.

    Or y at - it another way to transform the operating system in German? There should be an option to download additional languages, but this particual window has no other options. And I have not found any manual way to download other languages.

    Concerning

    Michael

    Sometimes it can be so easy... ;-)

    So here's my solution:

    1. go on the Web for hp Support site

    2. go in the software and driver download

    3. set the language of driver on the language of your choice (in fact: it was the main problem)

    4. download an operating system image

    5. run the configuration tool and copy the image of an operating system on a flash drive

    6. restart the workstation and install the os

    7. take advantage of your computer ThinClient in the language of your choice

    I don't know, why the hp Easy Tools downloaded the image of evil, but with this solution, that I find myself at the same point, as if they did.

  • From what I read, if I buy a commercial version full of windows 7, I am not eligible for the upgrade of $14.95 to windows 8 in about 6 months.

    I'm about to buy a computer with 16 GB of memory. I'll of course need a 64 bit OS, it looks like a good time to switch to windows 7, XP. But windows 7 seems to have a very short life span. The OEM version is eligible for a special download offer upgrade $ 14.95 to windows 8 that seems due Q1 2013, but it seems that the retail version is not eligible for this offer? Like many people I do not upgrade OS every time is out. But why would I pay for an OS which is replaced in 6 months?

    Huh?

    14.99 reduction is a limited offer in time when you buy a new computer between June 2, 2012 and on January 31, 2013, with Windows 7. By October 26, 2012, the PC of all major manufacturers will come preloaded with Windows 8. The thing, it is likely to be the inventory on the market with Windows 7 for a while of OEM brand. If a consumer buys one of them, they should have the eligibility for the upgrade of Windows 8.

    Of course, you can buy the new computer with Windows 7 pre-loaded, acquire the Windows 8 upgrade what becomes availalable and install it at your leisure and activate it whenever you're ready.

    Yes, the retail version of Windows 7 is not eligible for the upgrade 14.99 discount, but you can get an updated copy of Windows 8 Pro for 39.99 beginning October 26, 2012 and ending on January 31, 2013.

    Offers upgrade Windows 8:

    http://Windows.Microsoft.com/en-us/Windows/upgrade-offer

    Windows 8 Pro 39.99 Upgrade Windows XP, Vista and Windows 7 existing users:

    http://windowsteamblog.com/Windows/b/bloggingwindows/archive/2012/07/02/upgrade-to-Windows-8-Pro-for-39-99.aspx

  • "@specTypeName @" placeholder for extensibility of the Email does not work for the master specifications

    Hi all

    • I installed E-mail Feature Pack 4.1 extensibility 6.2 PLM.
    • I use "GSMEmailFileBasedVariablesFormatPluginFactory" to send e-mail notifications when work flowing from one status to another.
    • I am successfully able to generate notifications by e-mail for all GSM specifications with the content specified by me except the master specifications.

    "@specTypeName @" placeholder for extensibility of the Email does not work for the specifications of the master.

    Can you please help me solve the problem?

    FYI,.

    ' @specTypeName @ ' placeholder works in all other GSM specifications.

    Thank you

    Nefertari

    For the resolution of this problem, please see the following knowledge base document:

    Document 2079386.1 - Notifications by email for the specifications of the master only lack the Type of specification field

    Thank you

    Stephen, Oracle Support

Maybe you are looking for

  • Java plugin for Oracle hangs after the last update

    As part of the requirement of the Oracle, we run JRE 1.7.60To update firefox this morning and now the plugin is constantly crashing.

  • Break a file .rtf with new names

    Hello I have a huge rtf file which I hope to break in different files based on an identifier that is at the top of each part I want to break up. These files should still be rtf as they all html links I need to keep. The structure of the file is: 3 RE

  • Satellite Pro C50 - no webcam application

    Hello You just buy a C50 Pro Satellite, it is built in webcam but no application to use? drivers show in Device Manager and update but nothing use the camera. Also can't find no reference to this on the Web site, no device driver, without s/w? Only r

  • HP Envy 17-j150ca: hardware HP Envy upgrade

    Hello world I had my HP Envy 17-j150ca for nearly two years not and as it has its problems, I love this laptop. Recently, he has worked much more slow and is has become a little too outdated to run newer programs. I suspect it is a problem with the h

  • I can't copy and paste between documents

    I only just realized this when I went to copy a web address and paste it into a document. I know that I could copy the address but when I click on paste, paste is gray. I have not installed any software lately and I don't know that I could conduct la