Extract substring from string

Hi,
Iu2019m reaching out to the experts in the forum for assistance with resolving a code issue in Universe Designer u2013 itu2019s not producing the expected result.  The following are details, and steps taken:
Objective: To extract only the characters between #u2019s, i.e. u2013 Smith, John added comments on 12/1/11 V5M#0.25# this is a test.  *NOTE* The characters before AND after the #u2019s varies.
Database u2013 Oracle 10g
Field type u2013 CLOB (DBAu2019s will not change) u2013 I created an object u201CDescriptionu201D= DBMS_LOB.SUBSTR("Oracle_Test_Unv". DESC, 4000,1) u2013 I also tried casting as a varchar2 and still the same result.
Object u2013 Code to extract the characters between #u2019s:
     CASE WHEN @Select(Oracle_Test_Unv\Description) LIKE '%V5M#%#%'
                         THEN DBMS_LOB.SUBSTR(@Select(Oracle_Test_Unv\Description),
                                DBMS_LOB.INSTR(@Select(Oracle_Test_Unv\Description), '#',1,1)+1,
                                      DBMS_LOB.INSTR(@Select(Oracle_Test_Unv\Description), '#',1,2) -
                                           DBMS_LOB.INSTR(@Select(Oracle_Test_Unv\Description), '#',1,1)-1)
                                                ELSE '0'
                                                      END
Current Result:  Smith, John added comments on 12/1/11 V5M#0.25
Thanks in advance for your help!

Apologies, I forgot to include the expected result.  Please see below:
Expected result: 0.25
Thanks again!

Similar Messages

  • How to extract substring from string... how to find the index?

    suppose i have a string like
    "string1 string2 string3 string4 string....stringK...stringN"
    i would like to extract the substring from string4 to stringK-1
    where stringK and string3 are pre defined strings (ie, i know exactly what stringK and string3 is).
    is there a function to extract the substring from string4 to stringK-1
    or is there a function i can use to determine the index of the end of string4 and the start of stringK?
    thks!

    If your substrings are seperated by a space (or by any other character that isn't used in any of the substrings), you could use something like StringTokenizer.
    If you wanna get real fancy, use the split method of String.

  • Need a way to extract substring from string in oracle

    Hi all,
    I have one requirement related to extracting string from a paramater.
    suppose the string may like this in various format
    string:= 'This my string <Rid//problem/123456>'
    or
    string:= '<Rid//problem/123456> This my string'
    or
    string:= ' This is <Rid//problem/123456> my string'
    Now my requirement is i need to extract 123456 using pl/sql block.
    is there any way in oracle to get this thing done.
    Thanks n regards
    Laxman

    Hi,
    What version of Oracle ?
    How do you delimit the string to extract ?
    - always between the last / and before the >
    - the last string mande of number ?
    - the first string made of number ?
    Here are 3 possible answers :SQL> with s as (
      2  select 'This my string <Rid//problem/123456>' s from dual
      3  union all select '<Rid//problem/123456> This my string' from dual
      4  union all select ' This is <Rid//problem/123456> my string' from dual
      5  )
      6  select s.s,
      7  regexp_replace(s,'^.*/([0-9]*).*$','\1') r1,
      8  regexp_replace(s,'^[^0-9]*(.*?)[^0-9]*$','\1') r2,
      9  regexp_replace(s,'^.*/(.*?)>.*$','\1') r3
    10  from s ;
    S                                        R1       R2       R3
    This my string <Rid//problem/123456>     123456   123456   123456
    <Rid//problem/123456> This my string     123456   123456   123456
    This is <Rid//problem/123456> my string 123456   123456   123456If you're on 10g or more...
    Of course it also works in PL/SQL :SQL> l
      1  declare
      2  r1 varchar2(50) := 'This my string <Rid//problem/123456>';
      3  r2 varchar2(50) := '<Rid//problem/123456> This my string';
      4  r3 varchar2(50) := ' This is <Rid//problem/123456> my string';
      5  r1b varchar2(50);
      6  r2b varchar2(50);
      7  r3b varchar2(50);
      8  begin
      9  r1b := regexp_replace(r1,'^.*/([0-9]*).*$','\1') ;
    10  r2b := regexp_replace(r2,'^[^0-9]*(.*?)[^0-9]*$','\1') ;
    11  r3b := regexp_replace(r3,'^.*/(.*?)>.*$','\1') ;
    12  dbms_output.put_line('1 : '||r1||' -> '||r1b);
    13  dbms_output.put_line('2 : '||r2||' -> '||r2b);
    14  dbms_output.put_line('3 : '||r3||' -> '||r3b);
    15* end;
    SQL> /
    1 : This my string <Rid//problem/123456> -> 123456
    2 : <Rid//problem/123456> This my string -> 123456
    3 :  This is <Rid//problem/123456> my string -> 123456
    PL/SQL procedure successfully completed.Edited by: Nicosa on Jul 23, 2010 3:22 PM

  • Urgent pl.  I want to extract float from string (%f %s) or (%s %f) separate

    I want to extract float from string (%f %s) or (%s %f) separated by tab, whitespace etc., Since I am using jdk1.3.1 I can't use regular expression can anybody suggest a simple (one or two or few line code - compact) to get the float in (sign+/-)#.#### format ignoring other characters ?
    I tried:
    e.g.,
    String d="4.000 [tab]4";
    source string resulted from "SUBSTRING query of mySQL" can be of :
    " -4.543 XYZ ",
    " XYZ -4.546 ",
    " xx-yy 6.58 3 ",
    "6.0 xxx yyy zzz",
    the expected results for float from the string should be:
    -4.543
    -4.546
    6.580
    6.000
    If String containing data separated by comma:
    e.g.,
    "4.120     1     ,
    AAXXFE     ,4.206     1     ,
         4.000     1,
         4.201     1,
         4.189     1,
         4.204     1,
    S     DDERSF-RSA"
    The result should be: "4.120,4.206,4.000,4.201,4.189,4.204,0.000"
    The string is created by:
    ResultSet rs1 = stmt.executeQuery(S1);
    while (rs1.next()) {  
    String d = rs1.getString("SUBSTRING(FIELD1,LOCATE(\""+s2[i]+"\",FIELD1)+"+ k_st + ","+ length+")");
    System.out.print(d+",");
    May be I don't know how to use the following:
    float f1 = Float.parseFloat(d);
    ===
    String pattern = "###.###";
    //float value = -2100.578f;
    DecimalFormat myFormatter = new DecimalFormat(pattern);
    String output = myFormatter.format(d);
    System.out.println(d+" " + pattern + " " + output);
    ===

    Hi
    You made the best choice. JRegex is closer to java.util.regex.* and fine works with excellent performance in any JVM version so you can use examples/tutorials from both JRegex and Java.Sun.Com to learn more about regular expression.
    About the regular expression in my last post, there are two capturing groups: the first for float numbers in IEEE format specification (also see Java Language Specification) and the second for any sequence of chars, groups using with any amount of blank spaces (spaces, tabs, etc :: see regular expression definition) as delimiter. The anchors "^" and "$" are being used to exactly match pattern in target string and you can relax this constraint as needed.
    How to use JRegex? no secrets!
    import jregex.*;
    // a float number and string with any blank delimiter
    String patternString ="^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\s+(.*)$";
    Pattern pattern = new Pattern(patternString); // different from Sun regex package syntax
    // below is identical in both packages
    Matcher m = pattern.matcher(anyTargetString);
    if (m.matches()) {
      Double d = Double.parseDouble( m.group(1) );
      String scratch = m.group(2);
      // your stuff goes here
    ..Remember to put JRegex jarfile in classpath!
    Regards and Success.

  • How to extract substring from a string based on the condition ??

    Hi,
    I'm having a very large string which as below
    EQD+CN+SAMPLE18767+2200+++5'
    NAD+CA+FIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++GOOD'
    FTX+AAA+++ONE'
    EQD+CN+SAMPLE18795+2200+++5'
    NAD+CA+TIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++SECOND'
    FTX+AAA+++IS FAIR'
    similarly FTX+AAA as above and it goes on
    i tokenized each segment with delimiter as ' and able to read each segment.
    Now i want to concatenate the FTX+AAA in a single segment if more than one FTX+AAA with IMMEDIATE below
    The output is as follows
    EQD+CN+SAMPLE18767+2200+++5'
    NAD+CA+FIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++GOOD,ONE'
    EQD+CN+SAMPLE18795+2200+++5'
    NAD+CA+TIR:172:20'
    DGS+IMD+3.2+2346+55:CEL'
    FTX+AAA+++SECOND,IS FAIR'
    similarly FTX+AAA should be concatenated if it has similar FTX+AAA IMMEDIATE below.
    The FTX+AAA segments can come any number of times immediate below
    Please help me how we can do this??? Can anyone help me with the code snippet to do this?
    Thanks,
    Kathir

    Encephalopathic wrote:
    You've posted > 300 times here and you still don't respect the rule regarding notification of all cross-posts? [http://www.java-forums.org/advanced-java/30061-how-extract-substring-string-based-condition.html]
    Do you think this this will help convince others to help you?See also [http://www.coderanch.com/t/500088/java/java/extract-substring-string-based-condition|http://www.coderanch.com/t/500088/java/java/extract-substring-string-based-condition].

  • More efficient way to extract number from string

    Hello guys,
    I am using this Regexp to extract numbers from a string, and I doubt that there is a more efficient way to get this done:
    SELECT  regexp_replace (regexp_replace ( REGEXp_REPLACE ('  !@#$%^&*()_+= '' + 00 SDFKA 324 000 8702 234 |  " ' , '[[:punct:]]',''), '[[:space:]]',''), '[[:alpha:]]','')  FROM dual
    {code}
    Is there a more efficient way to get this done ?
    Regards,
    Fateh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Or, with less writing, using Perl syntax \D (non-digit):
    SELECT  regexp_replace('  !@#$%^&*()_+= '' + 00 SDFKA 324 000 8702 234 |  " ','\D')
      FROM  dual
    REGEXP_REPLACE(
    003240008702234
    SQL>
    {code}
    SY.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to get substring from string starting from the end of string

    Hi
    How to cut from string:
    $A=C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    this substring (name of VHD file): WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    This script should be universal so the best way to be cut all leters from the end of string $A till get the first mark \
    Thank you for help.
    Tomasz
    Kind Regards Tomasz

    PS > Split-Path 'C:\ClusterStorage\Volume1\WXP-plwropc300\Virtual Hard Disks\WXP-PLWROPC300_EE20E00F-315E-4781
    -A6DE-68497D4189B8.avhdx' -leaf
    WXP-PLWROPC300_EE20E00F-315E-4781-A6DE-68497D4189B8.avhdx
    PS >
    That is what "Split-Path" is for:
    ¯\_(ツ)_/¯

  • Extract date from string in T-SQL

    Hi,
    I am having one field(AT_TEXT) in my database that has below kind of values. I want to extract date from this string but the issue is all rows has different format.
    1)One Month Lttr sent on 3/12/2009 due to
    2)One Month Letter sent on 1/15/2009 due to
    3)One Month letter sent on7/15/2011.The amount due             - This has no space between on and 7 and . after yr
    4)One Month letter sent on 7/16/12 due to        - This has 12 instead of 2012(2 positions after 2nd slash/)
    Can anyone please help me to write query to extract date from this string?
    Vicky

    Hi Jingyang
    Li,
    I checked your query and it looks good but I have one issue. So when we reverse it, it looks like below and it is talking that $57.80 as a 1st numeric value and try to convert it into date and giving me error.
    I realize from your query that you are trying to reverse the value and then try to find out 1st Numeric value from that string, but my whole string has another numeric value at the end, like 
    "One Month Letter on 1/15/2009 due to non-pmt of prems-amt to avoid DE is $57.80"
    So when we reverse it, it looks like below and it is taking that $57.80 as a 1st numeric value and try to convert it into date and giving me error.         
    "08.75$ si ED diova ot eud tma - smerp fo tmp-non ot eud 9002/51/1 no retteL htnoM enO"
    Also sometimes I have $ amount at the end and sometimes I don't have any $ amount at the end, like below,
    "One Month letter sent on 10/15/2012 due to non-payment of premiums. The amount due to avoid dise"
    Can you please modify your query which takes only date part not the $ amount and give me?
    Thank you so much for your help 
    Vicky

  • Finding substring from string.

    I'll have to find substring from another string. Substring to find can be example: CVB and the string can be example ACHGVNB.
    Give me some hints about what methods I should use.

    Like this:public class Test {
        public static void main (String[] parameters) {
            String sub;
            String text;
            if (parameters.length == 2) {
                sub = parameters[0];
                text = parameters[1];
            } else {
                sub = "levi_h";
                text = "l e v i _ h";
            System.out.println (isSub (sub, text));
        private static boolean isSub (String sub, String text) {
            int s = 0;
            int t = 0;
            while ((s < sub.length ()) && (t < text.length ())) {
                if (sub.charAt (s) == text.charAt (t)) {
                    s ++;
                t ++;
            return s == sub.length ();
    }Kind regards,
    Levi

  • Extract Characters from String

    Hi
    Can anyone let me know how can i extract the letters HIJK from the following string
    Sting s = "ABCDEFGHIJKLMNOP"
    Thanks

    Thanks for that
    but if i do something like this it falls over
    String temp = s.substring(12, 3);You posted this response 2 minutes after the previous response. This means you obviously didn't take the time to read the String API to find out more information about the parameters for the method. Take some time to learn about new methods before claiming they don't work.

  • Hyperion Brio: Computed Item Extract Number From String

    I would like to extract a number from a string in a computer item.  For example if I had a string such as "The customer purchased $5.00 of footballs", I would like to remove only the 5.00 from the string.  I would have to use the java functions in the results.  Any suggestions on how to do this?

    you can do this in the Results section with a computed column using the native string functions.  to break it down i have split it up a bit.
    strval is you string "The customer purchased $5.00 of footballs"
    position of $ = 25
         Instr ( strval, '$', 1, 1 )
    the starting position of the amount would then be 26
         Instr ( strval, '$', 1, 1 ) + 1
    position of decimal after $ = 26
         Instr ( strval, '.', Instr ( strval, '$', 1, 1 ), 1 )
    using Substr function you need to pick the string, the start value and the number of characters.
    string
         = strval
    start position
         = Instr ( strval, '$', 1, 1 ) + 1
    number of characters - location of decimal minus the start position plus 3 to get the cents
         = Instr ( strval, '.', Instr ( strval, '$', 1, 1 ), 1 ) - Instr ( strval, '$', 1, 1 )  + 3
    put all together
    Substr( strval, Instr ( strval, '$', 1, 1 ) + 1,  Instr ( strval, '.', Instr ( strval, '$', 1, 1 ), 1 ) - Instr ( strval, '$', 1, 1 )  + 3 ) * 1
    the multiply by 1 converts the string to number

  • How to get substring from string using index?

    hi,
    here i am having string ,
    i want the pullareddy from below line ,
    i know how to get from substring.
    but i want to get the above using "index",
    can any help how to do it?
    String str1="janapana,pullareddy, in malaysia";
    jpullareddy

    get the start index with indexAt("pullareddy")
    get the end index with adding the length of the word to the start
    get the char[] of str1 with toCharArray()
    make a new string with the chars from start to end index.

  • Extract Number from string

    I need to extract the number, if it exists, from an alphanumeric text string.  I am told that the first two characters will be alpha and the remaining character(s) will be numeric, if the numeric exists at all.
    I know this is a simple formula, but I can't quite get it.

    Are the two alpha and remaining numeric characters always in the same position within the string?
    Are the two alpha characters always going to be the same?
    Is the length of the numeric value following the two alpha characters always going to be the same?
    The more no answers you have to the above the tougher it will be!
    Get back with the above answers and possibly copy and paste some examples of the ENTIRE strings from which you will be extracting the values and let us know which are the values you'll be pulling from within the larger string.
    "I need to extract the number, if it exists, from an alphanumeric text string. I am told that the first two characters will be alpha and the remaining character(s) will be numeric, if the numeric exists at all.
    I know this is a simple formula, but I can't quite get it."

  • Extracting data from string

    Can anyone point me in the right direction as to how URL's
    can be extracted from a string?
    Or at least find the start and end positions...
    EG:
    I want to get the URL's from the "a href"'s...
    String- "The quick brown fox jumps over the lazy dog, <a
    href="
    http://www.example1.com">click
    here</a>. The quick brown fox jumps over the lazy dog, <a
    href="
    http://www.example2.com">click
    here</a>.".

    Hi,
    You can do this by using the "anchors" object in
    "Javascript".. Below is the Sample Code..
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <script language="javascript">
    function fnCheckAnchors()
    for (var i=0;i<document.anchors.length;i++)
    alert(document.anchors.item(i));
    </script>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form name="form" action="" method="post"
    onsubmit="fnCheckAnchors();">
    <a name="1" href="
    http://www.yahoo.com">Yahoo</a><br
    />
    <a name="2" href="
    http://www.google.com">Google</a><br
    />
    <a name="3" href="
    http://www.altavista.com">Altavista</a><br
    />
    <input type="submit" name="submit" value="Submit" />
    </form>
    </body>
    </html>

  • Compare and extract number from string

    Hi, all
    If I want to compare a requirement number and extract a number form a continuous data, . for example,
    the string like this ( ******** 123 ******
                                   *********456 ******
                                   *********789*******)
    and I have requiremnts that I need to extract the number is nearest greater 450, so in the above example, I need to pick 456.
    How can I result it?
    thanks

    Just extract all numbers into an array, then find the element with the smallest absolute difference. See attached (LabVIEW 7.0).
    EDIT: Sorry, If by "Nearest greater" you mean the next higher number, you can use something like in my example II. (Also LabVIEW 7.0).
    If you don't recognize an node, just right-click on it and select help.
    You still need to add proper execption handling, e.g.:
    What if no element is greater?
    What if there are multiple solutions?
    What if the string does not contain any numbers?
    Message Edited by altenbach on 10-13-2005 09:05 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FindClosest.vi ‏29 KB
    FindClosestII.vi ‏30 KB

Maybe you are looking for

  • Using LabVIEW to Generate an XY Graph of Multiple, Indexed Plots?

    Hello, I have written a LabVIEW Program (using 8.2.1) to characterize FETs using GPIB instruments. At it's most basic level, the program sets a voltage across the Gate-Source terminals of the FET, sets a voltage across the Drain-Source terminals of t

  • Voting poll using PHP & MySQL TypeError: Error #2007: Parameter text must be non-null.

    I am getting this back: TypeError: Error #2007: Parameter text must be non-null. at flash.text::TextField/set text() at AS3_Flash_Poll_PHP_MySQL_fla::WholePoll_1/completeHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.even

  • Playing out to video monitor

    Hi. I'm running FCP 4.5HD, and currently using dual Apple Cinema Displays. I use 2 Sony HDV decks, which connect to a Panasonic HDTV as my video monitor. When I capture or when I mix down to video or tape, the video plays on both the HDTV and on my d

  • Nokia Lumia 1020 Recording Questions

    I'm planning on recording a show that I am involved in with a Nokia Lumia 1020 (which I haven't actually got yet), but was wondering whether it's possible to use the 1020 as just a camcorder and live capture/save the video file to a laptop? I've hear

  • Much of my audio was moved to the right +.6

    Yesterday I did a lot of editing with the timing of clips. I would find some clips coming in too soon so I would make adjustments to make them start later so as to make the pacing and flow of the video better. The video is long at almost 2 hours. I t