How to search for a string in the order reversed through REGEXP_INSTR

Hi all

I have the SQL query in which I want to get the first position of the occurrence of the end of the string

for example:
String:NBANK-ASD-00-1001-525-1002
Condition: the position of the character '-' the last. (Note: character can also be '-' or ' / ')
output: 1002

for above condition, I have a request next return


SELECT SUBSTR('NBANK-ASD-00-1001-525-1002',REGEXP_INSTR('NBANK-ASD-00-1001-525-1002','[^-/]',1),LENGTH('NBANK-ASD-00-1001-525-1002 ')) FROM dual;



but I'm getting more results

NBANK-ASD-00-1001-525-1002
means that the expression returns 0...

pls help me solve this problem.

You can change your query as follows

 SELECT SUBSTR('NBANK-ASD-00-1001-525-1002'
   , REGEXP_INSTR('NBANK-ASD-00-1001-525-1002', '[^-/]*$', 1)
   , LENGTH('NBANK-ASD-00-1001-525-1002'))
   FROM dual;
;

but you can just use REGEXP_SUBSTR to get the same result...

 SELECT REGEXP_SUBSTR('NBANK-ASD-00-1001-525-1002', '[^-/]*$', 1)
   FROM dual;
;

Kind regards
Bob

Tags: Database

Similar Questions

  • How to search for games/app in the store?

    Is there to research apps/games in store windows. As I want to search some games and app, but I have not found where can I search for any game/app in windows store.

    As in all applications of windows 8, looking for the charm of the research.

    Open the store, open the charm of search, look further.

    You can even do the opposite. Open the charm of search anywhere and then select the store in the list of available places under the search field.

    In addition, you can also simply open the app store and start typing. Everything you type will be automatically added to the charm of the research.

    http://Windows.Microsoft.com/en-GB/Windows-8/charms

  • The search for exact strings (and the right formula)

    I am using FIND instruction to search multiple strings in a larger formula. The original formula that I do stand out is the following:

    = IF (ISNUMBER (FIND ('INC', A1)),' ', 'Y')

    Of course, this gives a Y if he finds some text in "". "" However, I have several channels for which I would check, and they need to be exact. That is to say when I search Inc. and Inc., I don't want Inc. to be counted. So, I tried the following formulas.

    = IF (ISNUMBER (FIND (OR("INC",inc"), A1)),' ', 'Y')

    = IF (SUM (COUNTIF (A1, "* INC. *","{* Inc. *}")),' ',' Y')

    The second works better, but it also counts Inc. as a football game. Any suggestions?

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • How to search for a string in a column using REGEXP


    Hi Forum,

    I have a table with a column that has records that contain one of the 3 words viz.

    TABLE X

    col1

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

    remit_method = EMAIL/remit_details = some other details

    remit_method = SMS/remit_details = some other details for sms

    remit_method = POST

    I need to write a SQL that captures the remit_method of the column. I wrote SQL using SUBSTR and INSTR to capture him. But I was wondering if I could do it using the functions of RegExp as well?

    SELECT REGEXP_SUBSTR (col1) == > how?

    Of

    (

    SELECT ' remit_method = EMAIL/remit_details = FROM DUAL some other details

    UNION

    SELECT ' remit_method = SMS/remit_details = some other details for FROM DUAL of sms

    UNION

    SELECT 'remit_method = POST' FROM DUAL

    ) ;


    Output must be

    1st row = > EMAIL

    Row2 = > SMS

    Row3 = > POST

    Thank you

    Maëlle

    Like this...

    SQL > ed
    A written file afiedt.buf

    1 with tablex as (SELECT ' remit_method = EMAIL/remit_details = col1 OF DOUBLE UNION some other details)
    2. SELECT ' remit_method = SMS/remit_details = some other details OF UNION of the sms for DOUBLE
    3. SELECT 'remit_method = POST' FROM DUAL
    4                 )
    5 SELECT REGEXP_REPLACE (col1, ' ^ remit_method =([[:alpha:]]+). * $', '\1') as remit_method
    REGEXP_REPLACE 6, (col1, ' ^. * remit_details =(.*) $ |. *', '\1') as remit_details
    7 * FROM tablex
    SQL > /.

    REMIT_METHOD REMIT_DETAILS
    -------------------- ----------------------------------------
    A few other details by E-MAIL
    Publish
    Other details for sms SMS

  • How to search for CompanyName, title of the post, the Web page and the Notes of BalckBerry Contact?

    Hi all

    I do not know how to recover CompnayName, job title, Web page and Notes

    contact BlackBerry.

    I retrieve the name, birthday, number of telephone and address. But I can't retrieve these values.

    Please help me

    Thanks in Advacne.

    Did you check out this article.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800363/How_To _...

    It has BlackBerryContact.ORG, BlackBerryContact.TITLE mentioned in the example.

  • Search for a string in the data merge, and then change the font color

    I'm working on an invitation from style postcard with the addresses overleaf. So far, I got the invitation and the mail-side with a fusion of data model to a CSV file successfully. Now, as part of my design, I want all the s of the letter 'b' on the model of mail-side (data fusion) of yellow color. The use of JavaScript is it possible? That's what I have so far, but something is wrong:

    app.findTextPrefences = NothingEnum.NOTHING as FindTextPreference;

    app.changeTextPrefences = NothingEnum.NOTHING as ChangeTextPreference;

    var myColor:Color = myDocument.colors.add ();

    myColor.model = ColorModel.PROCESS;

    myColor.space = ColorSpace.CMYK;

    myColor.colorValue = [0, 0, 100, 16];

    app.findChangeTextOptions.caseSensitive = false;

    app.findChangeTextOptions.includeFootnotes = false;

    app.findChangeTextOptions.includeHiddenLayers = false;

    app.findChangeTextOptions.includeLockedLayersForFind = false;

    app.findChangeTextOptions.includeLockedStoriesForFind = false;

    app.findChangeTextOptions.includeMasterPages = false;

    app.findChangeTextOptions.wholeWord = false;

    app.findTextPrefences.findWhat = 'b ';.

    app.changeTextPrefences.fillColor = myColor;

    app.findTextPrefences = NothingEnum.NOTHING as FindTextPreference;

    app.changeTextPrefences = NothingEnum.NOTHING as ChangeTextPreference;

    Hello

    After you set the preferences you must call the changeText() method, as

    myDoc.changeText ();

    or

    myStory.changeText ();

    But it is a static solution.

    You can use a dynamic solution to define a good characterStyle and take advantage of the nestedGrepStyle style applied to this part of your design.

    For each character 'b' could be applied with your characterStyle automatically, no need to run a script.

    Jarek

  • How to search for a string with various occurrences using regexp_substr

    Hi all.

    My cenario's

    '.... 456re0, 50kg 400, 500rfabs43qre30, 25kg 150, 354rf658... »


    It is possible, using regexp_substr or another way to get the values, 0,50 and 400 500 and 30.25 150 354?

    I am using [^ d] + [$kg] and the string comes, but only the first occurrence...

    TKS.

    claudioaragao wrote:
    I need the results of...

    with sample_table as (
                          select '....456re0,50kg400,500rfabs43qre30,25kg150,354rf658....' str from dual
                         )
    select  regexp_substr(str,'re.*?rf',1,column_value) sub_str
      from  sample_table,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by regexp_substr(str,'re.*?rf',1,level) is not null
                               )
                       as sys.OdciNumberList
                      )
                )
    / 
    
    SUB_STR
    -------------------
    re0,50kg400,500rf
    re30,25kg150,354rf
    
    SQL> 
    

    SY.

  • How a search for certain content through many files?

    Windows 7 claims to be able to search for certain substances, but it does not work, or is not properly documented. My filenames have the extension "ls2" and are open with Notepad. How can I search for a string in the content of my ls2 files?

    Hello

    Maybe this will help: (mainly those of type "BOLD" )

    Tips for finding files
    http://Windows.Microsoft.com/en-us/Windows-Vista/tips-for-finding-files

    How to use advanced search in Vista Options
    http://www.Vistax64.com/tutorials/75451-advanced-search.html

    How to restore the page button on the Start Menu after installing Vista SP1
    http://www.Vistax64.com/tutorials/145787-Search-start-menu-button-restore-after-SP1.html

    How to restore the context Menu item search after installing Vista SP1
    http://www.Vistax64.com/tutorials/134065-search-context-menu-item-restore-after-Vista-SP1.html

    How to create a shortcut on the desktop search in Vista
    http://www.Vistax64.com/tutorials/126499-search-desktop-shortcut.html

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

    Win Key F opens advanced search

    Searching in Windows Vista, part 1
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-1-secrets-of-the-search-box

    Part 2
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-2-Start-menu-and-control-panel-search-tips

    Part 3
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-3-using-advanced-search-for-those-hard-to-find-files

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Under XP I could search for a string in all the files on my computer. I can't find this search function of SMEs on Windows 7. Anyone?

    On Windows XP, there is a search function to search for a string in any kind of files on your computer. You are looking for a specific name was easy, if you fogort what kind of file, this name occurred in or what it was named.

    On Windows 7 it only allows searching for a name of a file.  How to search for strings in file names?  29/12/12 Paul Figueroa

    Oh, what you want is the content property.

    content: ~ = Figueroa

    [Update: apparently special search symbols such as ~ = do not work with the content when property indexed research places, but work during the search in unindexed locations.]

    I should mention that Windows 7 Search is not case sensitive, so it makes no difference to try to find upper or lower case letters.  In addition, Windows 7 Search is not able to search the contents of files that have no file extension.  There is also a weird question having to watch in Indexing Options to determine which file extensions are defined for content, research, where you have a type of unusual file that is not defined for the content of the search.

  • How can I tell the mail client to search for new mail on the server?

    How can I tell the mail client to search for new mail on the server?

    Within the Mail app and display the Inbox you can pull down on the list of e-mail using your finger and you should see a small reel spinning gear. Which indicates that his check new email.

    You can also go into the settings of e-mail and calendars Contacts and view the settings there. Examine the settings of "search for new data. If the Push is enabled, then messages will be pushed to you if the email provider supports this feature. You can also set your accounts to use Fetch and set the frequency, he's going to go out and look for new e-mail messages.

  • I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?

    Set a password to disk... disk tab in the utility... and just give to those you want to use the TC...

  • How to search for text in all of the PDF files on a mobile device?

    How to search for text in all of the PDF files on a mobile device?

    Not possible on mobile devices.

  • Debug: how to search a text string (s)?

    In the debug command, how to search for a text string?

    I tried both a mystring' and 'mystring' ' does not.  They return all two syntax errors ("^ error").

    "According to aid debugging (" "?" command "), the syntax is the list of the range".  Note that no argument is indicated as optional.

    If I enter a range, what is the syntax in general?  And what is the syntax for 'all '?

    I tried * 'mystring' ' does not.  I get the syntax error (' ^ error ") pointing on «*»

    And what is the syntax for the 'list', in particular to specify a text string?

    I wrote:

    In the debug command, how to search for a text string?

    Well, duh!  A Google search for "debug windows" (without the quotes) found this handy employment guide:
    http://thestarman.pcministry.com/ASM/debug/debug.htm.

  • Please, give me an advise how to search for a number in a file xml (as3.0)

    Hello! Sorry for the troubling.

    Please, give me an advice how to search for a number in a file xml (as3.0)

    Thank you!

    My answer was based on your question to find numbers anywhere in the data to an xml file.  If you know that the data is digital data and the names of the nodes that contains this data, you do not have to check the characters and can only check numerical data using string values...

    function searchXMLFile(Event:MouseEvent):void
    {
    searchDisplay.text = "";
    var pageList:XMLList = xmlFileToSearch.receipt.number;
    searchDisplay.text = "false";
       
    for (var i: int = 0; i< pagelist.length();="">
    {

    If (pageList [i] == searchInput.text) {}
    searchDisplay.text = "true";
    }

    }
    }

    Even if you are looking for individual digital characters in the previous code that you would have always done by a false exit due having the line 'false' always cancel the real line...

    If (t.toString () .indexOf (m_sSearchTerm)! = - 1).

    {

    searchDisplay.text = "true";

    }

    searchDisplay.text = "false";  This will always overwrite the textfield

  • How to search for a word in a web page

    I wish I could do a search for a specific within the page currently displayed in the browser. Is it possible to do this in Firefox?

    Hi JossefPerl,

    Research on a page is actually very easy. You can simply press CTRL + F to use the search feature. You should take a look at the article in the Knowledge Base on How to search the contents of the current for text or links page for more information.

    Hope this helps!

Maybe you are looking for