How do you return a grouped expression from REGEXP_SUBSTR?

I have the string USERSbthompsonDESKTOP, and I want to return 'bthompson'.
Something equivalent to this Perl code:
my ($user) = $string =~ /USERS(.+?)DESKTOP/;
print "$user\n";
Output is 'bthompson'.
-- This does not work...
select regex_substr('USERSbthompsonDESKTOP', 'USERS(.+?)DESKTOP') from dual;
returns: USERSbthompsonDESKTOP
I tried adding a backreference, but don't know how it works.
select regexp_substr('USERSbthompsonDESKTOP', 'USERS(.+?)DESKTOP', '\1') from dual; -- Return the first expression?
returns:
ORA-01722: invalid number
01722. 00000 - "invalid number"
*Cause:   
*Action:
select regexp_substr('USERSbthompsonDESKTOP', 'USERS(.+?)DESKTOP\1') from dual;
returns Null.
Is there a way to return only 'bthompson' from that string?

Hi,
In Oracle 10, you can use REGEXP_REPLACE for that:
SELECT  REGEXP_REPLACE ( 'USERSbthompsonDESKTOP'
                 , '.*USERS(.+?)DESKTOP.*'
                 , '\1'
                 )          AS middle_part
FROM    dual;In Oracle 11, you can also use REGEXP_SUBSTR:
SELECT  REGEXP_SUBSTR ( 'USERSbthompsonDESKTOP'
                , 'USERS(.+?)DESKTOP'
                , 1
                , 1
                , NULL
                , 1
                )          AS middle_part
FROM    dual;

Similar Messages

  • How do you return back one record from a NamingEnumeration

    how do you return back one record from a For Loop issue
    Posted: Jan 4, 2007 9:13 AM Reply
    I have the following piece of code and i want to be able to just return one item...
    that is return e.next(); but this line doesnt work for below what is wrong
    if (attrs == null) {
    System.out.println("No attributes");
    } else {
    /* Print each attribute */
    for (NamingEnumeration ae = attrs.getAll();
    ae.hasMore();) {
    Attribute attr = (Attribute)ae.next();
    System.out.println("attribute: " + attr);
    /* print each value */
    for (NamingEnumeration e = attr.getAll();
    e.hasMore();){
    System.out.println("value:- " + e.next()));
    return e.next();
    }

    At the end of the loop, the NamingEnumeration has no more elements. You need to call getAll() again.
    By the way, please use code tags (above the posting box). You've been here long enough to know that (judging by your registration date).

  • How Do You Delete a Group Invite from iPad?

    Has anyone figured out how to delete a group invite from iPad-- I removed it from the MAC computer without problem, but the sync with iPad and iPhone retains the invitation on iPad and iPhone.  I did not create the group email, just received it.  I sync through iCloud only.  There iappears to be no way to remove the event directly from either iPhone or iPad when clicking on the event.  Delete is not a choice.

    You need to either delete it from whatever app you manage you contacts with on your computer or use an iOS app such as ABC Contacts and others.
    Matt

  • How do you return back one record from a For Loop issue

    I have the following piece of code and i want to be able to just return one item...
    that is           return e.next(); but this line doesnt work for below what is wrong
    if (attrs == null) {
         System.out.println("No attributes");
    } else {
         /* Print each attribute */
         for (NamingEnumeration ae = attrs.getAll();
         ae.hasMore();) {
              Attribute attr = (Attribute)ae.next();
              System.out.println("attribute: " + attr);
              /* print each value */
              for (NamingEnumeration e = attr.getAll();
              e.hasMore();){
                   System.out.println("value:- " + e.next()));
              return e.next();
         }

    At the end of the loop, the NamingEnumeration has no more elements. You need to call getAll() again.
    By the way, please use code tags (above the posting box). You've been here long enough to know that (judging by your registration date).

  • The product I bought its not working as i expected, it doesn´t translate the exact information from pdf to excel, how can you help me or how can you return my money back....

    how can you help me

    What about adobé export PDF. ?
    Enviado desde mi iPhone
    El 07/05/2014, a las 23:00, Claudio González <[email protected]> escribió:
    The product I bought its not working as i expected, it doesn´t translate the exact information from pdf to excel, how can you help me or how can you return my money back....
    created by Claudio González in Adobe Reader - View the full discussion
    If you bought Reader, you were swindled, because it's a free program. And it has never been able of converting PDF files to any other format.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6363992#6363992
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Adobe Reader by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How do you return items from the trash can to their original locationn

    how do you return items from the trash can to their original location

    Welcome to the Apple Support Communities
    To restore a file on the Trash to its original location, open Trash, right-click the file or press it with Command key, and select Put Back

  • Just moving from PC to Mac. How do you select a group of items. On the PC it was shift right click

    Just moving from PC to Mac. How do you select a group of items. On the PC it was shift right click

    In list or column view, click the item at one end of the range and then shift-click the item at the other end.
    In icon view, click on an empty part of the window and drag to select them.
    (113533)

  • How do I send a group email from Droid MAXX Gmail android app?

    I have multiple groups setup in PEOPLE. How do I send a group email from my GMAIL app?

        glenholmes,
    You've come to the right place for help. Sorry to hear that you have had hard time with your Gmail app lately. What steps have you tried to get this to work? We want to ensure that you are able to start sending those messages right away.
    ErinW_VZW
    Follow us on Twitter @VZWSupport

  • How do you add another group of contacts on iPad Air

    How do you add another group of contacts on iPad Air

    If you mean create another group in contacts, on the iPad you can't. However, if you are syncing your contacts to icloud, you can from www.icloud.com.

  • How do you remove old email addresses from the invitee drop down menu in Calendar

    How do you remove old email addresses from the invitee drop down menu in Calendar

    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Caches/com.apple.iCal/Previous Recipients.plist
    Right-click or control-click the line and select 
    Services ▹ Reveal
    from the contextual menu.* A folder should open with an item selected. Quit the application if it's running. Move the selected item to the Desktop, leaving the window open. Relaunch the application and test. If there's no change, quit again and put the item you moved back where it was, overwriting the one that may have been created in its place. Otherwise, delete the item you moved.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • How do I copy final cut express from my computer onto a laptop

    How do I copy final cut express from my computer onto a laptop?

    You don't.  Several of the system level components won't be installed properly if you copy or 'migrate' to a new computer.  You'll need to install from the original install discs.
    -DH

  • How can a send a group email from ipad

    How can I send a group email from iPad

    You need a third party app. You can't create contacts groups in the built in mail app. Look at...
    http://solubleapps.com/mailshot/
    or
    http://www.redbits.com/iphone/groupemail/

  • How do you set up group in address book?

    How do you set up group in address book

    PINOOTS wrote:
    How do I add just 1 name to an already established group?
    Select All in the Group column.
    In the Name column, find, select, drag and drop the desired entry from the Name column on to the Group in the Group column.

  • How do you return episodes of shows or other material to the cloud so that it is not filling up your Pad

    How do you return episodes of shows or other material to the cloud so that it is not filling up your Pad

    Hey Shyster77,
    If this media was purchased on iTunes, then iTunes in the Cloud gives you access to most of your past purchases. You can delete it and whenever you want access to it again re-download it:
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/HT2519
    Welcome to Apple Support Communities!
    Have a great day,
    Delgadoh

  • How do you get your money back from a charge you never even made on the app store?

    How do you get your money back from a charge you never even made on the app store?

    Contact iTunes.
    How to report an issue with Your iTunes Store purchase

Maybe you are looking for

  • How to Use Property Loader to Load All Step Limits of SubSequence

    I have a MainSequence which have 7 Sequence Call Steps,and these Steps all have several Numeric Limit Test(LabVIEW Adapter),Now I want Creat a property Loader Step in the Setup Table of MainSequence to load all the SubSequences' Steps Limits.But I do

  • Macbook Pro 4,1 (early 2008) is the DVI port analog or digital?

    I have been tasked with a slide show presentation on a family member's HD TV using my MacBook Pro 4,1. The TV is a slightly older big screen TV without HDMI inputs. I would lke to use the component (YPbPr) inputs on the TV rather than VGA. VGA degrad

  • Parameter is not being applied

    Hey all i have the parameter in one of my reports, but when i change the value of the parameter the output or the result is not being changed. no matter what i do it will keep on showing me the same data any suggestions ?

  • My Mac is stuck on preparing to empty the trash stopping

    I downloaded some .wmv videos on my mac but I had trouble playing them so I moved them to trash and I put empty trash and it was just stuck like that so I stopped it and now its stuck on "stopping..." but still says "preparing to empty trash...".

  • Hyperlinks - Open in New Window?

    Probably answered somewhere previously, but is there any way to drop in proper code in the hyperlinks to make them open the target link in a new window on the published site instead of opening within the same window, thus user leaves your site? Thank