Get the second last occurrence of character

Hi
I want to get the second last occurrence of "_" from the following string and then take the 3 characters before this.
Does anyone know how to do it in a simple query?
The string is
ALS_AKM-G-2500_BASED_pre_paid_akm_mis_stv1

user2360027 wrote:
I wanted a simple query. The regular expressions are too much for me to understand :-)Not difficult at all:
regexp_replace(txt, '.*(.{3})_[^_]*_.*$', '\1')
\------------------/ \/\----/|\---/|\/|   \--/
         |           |    |  |  |  || |    |
         |           |    |  |  |  || |    and replace that found matching pattern with what is in backreference 1
         |           |    |  |  |  || |                                    (the 3 characters found in the pattern)
         |           |    |  |  |  || followed by the end of the string
         |           |    |  |  |  ||
         |           |    |  |  |  |followed by any characters
         |           |    |  |  |  |
         |           |    |  |  |  followed by an "_" character
         |           |    |  |  |
         |           |    |  |  followed by any number of non "_" characters
         |           |    |  |
         |           |    |  followed by an "_" character
         |           |    |
         |           |    followed by any 3 characters (mark as a back reference using brackets)
         |           |
         |           where it matches any number of characters
         |          
         replace the section of string txt

Similar Messages

  • When I open a new tab, how can I get the second tab to be me my home page also?

    I know how to right click and open a new tab when I am browsing but if I want to open just a blank new tab, how can I get the second tab to be my home page also?

    I know how to right click and open a new tab when I am browsing but if I want to open just a blank new tab, how can I get the second tab to be my home page also?

  • How do I get the second HD to be a shared network drive??

    PowerPC G5 / dual 2Ghz - used as our file server.
    running OS X Server - v.10.3.9
    Have one internal HD - 160GB partitioned into two drives (General Access & Archive) in the Public folder of this computer
    Appears as Network: Local / G5 Server. When you click the connect button you get a choice of which volume to mount/connect to (ie. General Access; Archive or both)
    Running out of space on the drive so I purchased a second 160GB HD. Installed it, formatted it (with DiskUtility), named it, and copied all files from Archive (partition)
    The thought is to make this new 160GB drive Archive and to remove the partition from the original 160GB HD and have that be just General Access.
    How do I get the second HD to be a shared network drive??
    Also can I remove the partition to the first without having to clone it and reformat?

    Roam & Ali B,
    Thanks!!
    Next dumb question(s).
    We have a laCie FW external HD that I was using as a back-up drive (temporarily)
    I do have some files on it that I have to bring back onto the server to use. I get a admin user&passsword prompt every time I have to copy something back. It usually copies over a locked file that can only be deleted from the Server terminal.
    1. Why isn't this working without the admin prompt? I used DiskUtil to format it before I could use it.
    2. How exactly do I "clone" the current content - its not a simple 'Select All' and drag&drop? Is it going to bring over the partition as well??
    3. Once I have everything on the FW HD, re-boot using it as the System, and re-format the original 160GB HD - will I run into #1.

  • How can I get the second group and report totals in Matrix report?

    Hi,
    I have created a matrix report with 2 break Groups.
    Iam getting columns totals for the first group, but not for the second group and the report totals.
    How can I get the second group and report totals for each month?
    Thanks.
    Ram.

    Hi Ram,
    If you want a total at any group-level, go to the particular group in the data model, insert a summary column in the group, and select
    Reset At > appropriate Group Name
    For report level summaries, you must create the summary column outside of all groups.
    Navneet.

  • Get line that contains and then get the second and fourth line after that.

    So I have a text file and I want it to find all the lines in the file that contain an @ symbol and then I want it to get that line and the line second and fourth from that line. Then I would export it like this:
    $linewith@ + ":" + $secondline + ":" + $fourthline
    Finding the lines with an @ symbol is easy, but how would I tell it to get the second and fourth line after the line with an @ symbol?
    So I would get the lines with something like this:
    foreach ($line in [System.IO.File]::ReadLines($filename)) {
    if($line.contains("@")){}

    That worked perfectly thanks man! Here is the entire code. I'm sure it could been cleaned up. I'm still learning powershell. 
    $username = "Username"
    $password = "Password"
    $url = "http://URL"
    $ie = New-Object -com InternetExplorer.Application
    $ie.visible=$false
    $ie.navigate($url)
    while($ie.ReadyState -ne 4) {start-sleep -m 100}
    $ie.document.getElementById("username").value = "$username"
    $ie.document.getElementById("password").value = "$password"
    $ie.document.getElementById("click").click()
    start-sleep 20
    $ie.Document.body.innertext | Out-File -FilePath c:\web.txt
    $links = $ie.Document.getElementsByTagName('A')
    $logout = $links | where {$_.innerText -eq 'logout'}
    $logout.click()
    start-sleep 5
    (gc C:\web.txt) | ? {$_.trim() -ne ""} | set-content C:\web.txt
    ( Get-Content C:\web.txt | Select-Object -Skip 2 | ForEach-Object { $_.TrimStart( " " ) } ) | Set-Content C:\web.txt
    start-sleep 5
    $fileContents = Get-Content C:\web.txt
    foreach ($line in $fileContents) {
    if ($line -like '*@*') {
    $line + ":" + $($fileContents[$line.ReadCount+0]) + ":" + $($fileContents[$line.ReadCount+3]) | Out-File -FilePath c:\finish.txt -Append

  • HT204088 accidentally purchased the same app twice, charged twice, how do i get the second charge removed?

    I bought the same app twice accidentally, how do I get the second charge removed?

    Go to ... http://www.apple.com/emea/support/itunes/contact.html ... and beg.
    Likelyhood is, if they are convinced it was an accident they will refund.   But its not something you can rely on.

  • How do I get the second disc to start at track 1 while tagging?

    I am trying to tag my music the way I prefer, and I know the tagging is right. I have the iPod Classic, but the tags I'm using does not work on my iPod because its an older model.
    I am going to explain what I mean and how I tagged them.
    For this example, it's a 2 CD album. 11 tracks on the first disc and 9 tracks on the second disc. I am tagging them iTunes so that disc 2 could start at track 1 and not track 12, but with my iPod being older regardless of my tags it's still starts at track 12 and not track 1 for disc 2 even though I don't want it that way.
    Here is how I tagged them. Highlight all tracks from disc 1 and put 11 in for the track of, then highlight all tracks for disc 2 and put in 9 for track of.
    Now since I have an older iPod model, are there any other ways to get every disc to start at track 1 even if its a 10 CD box set and not start at the next track number then the last track the disc ended so every disc would start at track 1?
    Thank you,

    this is how i do it. Hold the voice over button for about 5 to 6 seconds and to pick out your playlist just press on the track selection button. What that does is tells you the playlist that you have on your ipod. The very last thing is select the can of playlist you want by clicking on the play/pause button and you wold be albe to start at the beginning of your playlist.
    Message was edited by: Israel Clarkson Ipod geek

  • Howto: comparing 2 dates and getting the seconds

    By comparing 2 dates I need to extract or get somehow the elapsed seconds. I need to get only
    the seconds.
    Dates are in this format "hh:mm:ss"
    I tried with Date and GregorianCalendar but I couldnt get the desired result.
    Can someone provide me with a sample code please.

    remus.dragos wrote:
    Its not broken, nor absurd or complicated. I only need resolution only for minutes. The method that I use does not need to know more than 20 seconds.
    But I added minutes knoledge aniway. As you can see its easy to add hour resolution if needed. But I didnt needed it so thats why I took that approach.
    This looks cleaner for you? I just wrote it here, untested, but should work.
    public int returnSeconds(Calendar c1, Calendar c2)
    int mins =  c1.get(Calendar.MINUTES) - c2.get(Calendar.MINUTES);
    int secs =  c1.get(Calendar.SECONDS) - c2.get(Calendar.SECONDS);
    if (mins > 0) return secs+=mins;
    else            return secs;
    }And why should I treat all the time as miliseconds since the epoch. Thats an absurd afirmation without a detailed explanation.
    Edited by: remus.dragos on Apr 30, 2008 6:18 AM- Unnecessary creation of expensive Calendar objects.
    - Significantly slower
    - Breaks across Timezones
    - Unnecessary decision making introduces complexity
    - Introduces a bug by assuming c1 represents a time greater than c2
    - Introduces a bug by not multiplying minutes by 60 to obtain seconds.
    - Makes assumptions about the calendar system in use
    - Less maintainable because it limits the scope of time unit resolution handled by the logic
    I probably missed some more too. None of this is needed, and it is very brittle. Your problem can be solved by subtracting one fixed-point number from another. Go with es5f's approach.

  • Algorithm or pseudo code sought for getting the latest last modified time..

    Hi I need to write a program in java that lists the latest last modified time among the files in folders and its subfolder and also gets the size of the folder. In my case, average folder size is 9 GB. Could you please suggest any algorithm to achieve this?? I tried to implement it by gathering last modified times from folders and its subfolders recursively and storing the info in Vector and finally
    getting the max of the last modified times but it was horribly slow and memory hogging.

    Remove the part that stores the data in a Vector. You don't need to store any data to add up a series of numbers. And you don't need to store any data to find the largest of a series of numbers either. Just scan the directory recursively as you are already doing and keep track of the sum of the sizes and the max of the last-modified dates.

  • How to get the hex. value of unicode character

    Hi all
    I would like to get the hex. value of unicode and vice versa. I tried
    String name1 = new String(request.getParameter("textfield").getBytes("ISO8859_1"), "UTF-8");
    but it just get the unicode character, not the "hex value"
    pls help
    thx.
    Regards,
    Kin

    String str = "asdf";
    char c = str.charAt(0);
    System.out.println(Integer.toString((int)c, 16));
    Is that what you want? Or are you thinking "hex value" is something it's not, which is just a way of writing numbers in base-16.

  • How to get the second element in XML Response with same name

    Hi All,
    I am struck at this point, I have written a sample HTTP client which sends a request to the HTTP Server. In response to the request made the HTTP Server gives response in the XML format. eg: -
    <?xml version="1.0"?>
    <parent>
    <node1> Value1 </node1>
    <node1> Value2 </node1>
    <node2> Value3 </node2>
    </parent>
    In the HTTP Client I am getting the value of node1 using the following statement: -
    if (node instanceof Element && "node1".equals(((Element)node).getName()) )
    String node1 = node.getStringValue();
    System.out.println("Product Code:"+node1);
    This is always returning the first node1 value i.e. <node1> Value1 </node1>.
    The requirement is, I also need to get the <node1> Value2 </node1> value also. So can anyone tell me hw can I get the <node1> Value2 </node1> value. please tell me the piece of code that I should add to get the <node1> Value2 </node1>.
    My Mode is something like this: -
    try
                   Document document = (Document)DocumentHelper.parseText(response);
                   List<Node> transactionNodeList = document.selectNodes( "//parent" );
                   for(Node singleNode:transactionNodeList)
                        for(int i=0,j=0;i< ((Element)singleNode).nodeCount();i++ )
                             Node node = ((Element)singleNode).node(i);
                             if (node instanceof Element && "node1".equals(((Element)node).getName()) )
    node1= node.getStringValue();
    System.out.println("Air Way Bill Number:"+node1);
    if (node instanceof Element && "node1".equals(((Element)node).getName()) )
    node1= node.getStringValue();
    System.out.println("Product Code:"+node1);
    Thanks in Advance

    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder db=factory.newDocumentBuilder();
         Document doc=db.parse(new File(ur xml file"));
         Element root=doc.getDocumentElement();
         System.out.println("root "+root.getNodeName());

  • How to get the second and third.... words in a string

    Hi all,
    is there any way to get the words in a string seperate columns in a row.
    "xxx yyyy zzzz aaaa bbbb"
    required answer is
    a b c d e
    xxx yyyy zzzz aaaa bbbb
    a b c d e are the column names
    Thanks

    WITH t as (
      SELECT 'xxx yyyy zzzz aaaa bbbb' as t FROM dual
    -- end of sample data.
    SELECT t,
           regexp_substr(t, '[^ ]+', 1, 1) as a,
           regexp_substr(t, '[^ ]+', 1, 2) as b,
           regexp_substr(t, '[^ ]+', 1, 3) as c,
           regexp_substr(t, '[^ ]+', 1, 4) as d,
           regexp_substr(t, '[^ ]+', 1, 5) as e
      FROM t;
    T                       A                       B                       C                       D                       E                    
    xxx yyyy zzzz aaaa bbbb xxx                     yyyy                    zzzz                    aaaa                    bbbb                   

  • I have two Firefox profiles. The default is updated to the latest version. The second profile is version 3.6.25. I cannot get the second profile to update to the latest version. How do I do that?

    I do not have administrative authority on this computer but it has never been a problem before with updating.

    Thanks Corel. The computer I use at work is the one I'm having problems on. I also do work at home (where I am now) so I also have two Firefox profiles set up on my home computer. On my home computer when I updated the first profile both profiles updated, so I know it SHOULD work that way. On my work computer I did do the Help, About, version check and it told me I had the older version and needed to update, ran me through the update process but still the second profile was not updated. I will try the other two links, if the computer will let me since I'm not an administrator on it. That probably won't be until Monday. I don't really want to bug our director about it because she is so busy. I know that the Shockwave Flash and Java Plugins are outdated but they require administrator privileges to do. Something else I just thought of, every time I start that second profile at work it was saying Firefox was not my default browser, did I want to make it the default browser, I would agree, but still it would happen the next time. When I go into Tools, Options and look, it says Firefox IS my default browser. I finally told it not to check each time it starts. I don't know if this is connected to my original issue or not. Thanks for the advice and I will check it out next week and let you know how things go.

  • We had a Ipad 1st generation IOS5.  Added second email address for Messaging.  Tested and message came from 1st email address.  How do you get the second address to be the sender?

    Have a 1st generation Ipad IOS5 and added a second email address for messaging.  Tested sending a message to my Iphone and it was received as being sent by the first email address.  How do you select the second email address as the sender of a message?

    Hello slapshot13scotty,
    The information below details where to adjust both where messages are sent from and received.
    Receive iMessages using another email address:
    Go to Settings > Messages > Receive At > Add Another Email.
    Specify the phone number or Apple ID email address that appears in the “from” field when you start a new conversation:
    Go to Settings > Messages > Receive At > Caller ID.
    Existing conversations aren’t affected when you change this setting.
    iPhone User Guide
    http://manuals.info.apple.com/MANUALS/1000/MA1622/en_US/iphone_ios5_user_guide.p df
    Cheers,
    Allen

  • I purchased multi-computer license of Lightroom. First computer loaded fine.  Cannot get the second one.

    I purchased a multi-computer license of Lightroom 5.  The first computer was no problem.  I am unable to figure out how to get it onto a second computer.  I have an Adobe account and can sign in.  It shows my license.  How do I get it for my laptop?

    Thanks for the reply.  I do not find a Creative Cloud APP.  I bought the license outright, not on a monthly fee basis.
    J

Maybe you are looking for

  • Inbound connection & MTTR problem

    Dear Friends , I have to find the following errors in my production server . My oracle and server status is : SQL> select * from v$version; BANNER Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi PL/SQL Release 10.2.0.1.0 - Production

  • Installing Solaris 10 On HP ML 350 G5

    I have a problem when installing solaris 10 on HP Proliant ML350 G5, it says no disks found, I have smart array controller E/200 from HP, i downloaded the driver and followed the steps for updating driver during installation of solaris 10, but i stil

  • ALE/IDOC interview q's with answers(urgent)

    Hi folks, I want ALE/IDOC q's and answers .I have gathered some ,but still i want more...Please send as soon as possible. Regards, nagaraj

  • Why do I have so many "unknown" contacts?

    One of my most used contacts for both iMessage and FaceTime comes up as unknown. Most of the unknown contacts are from emails contacts. I have changed the computer I sync with from a PC to a MacBook Pro. I heard there is software to sort out contacts

  • Is it possible to cache and index and not cache the table?

    can someone point me to the syntax? I have been messing with it and can't get the cache command on the indexes to work. I dont want to cache the table. Just the index blocks.