Separation of Numbers from string

Hi All,
In my project i have a requirement where i need to remove the numerical values from the given string ...
For ex My input:CLWMEK0299
Expected Output : CLWMEK
Kindly please let me know ASAP... '
Thanks and regards,
Sudarshan
Edited by: Sudarshan on Mar 28, 2012 9:51 PM

Look at this SQLPLUS:
SQL> select regexp_replace('123abc', '[0-9]','') from dual;
REG
abc
SQL> select regexp_replace('1a7bc', '[0-9]','') from dual;
REG
abc
SQL> create table T ( Text varchar2(20));
Table created.
SQL> insert into T values ('12abc345');
1 row created.
SQL> insert into T values ('abc12345');
1 row created.
SQL> insert into T values ('123abc');
1 row created.
SQL> commit;
Commit complete.
SQL> select regexp_replace(Text, '[0-9]','') from T;
REGEXP_REPLACE(TEXT,'[0-9]','')
abc
abc
abc
IN OBIEE front end - Suppose in the column formual of column - Prod_desc - You have to use evaluate function - like this -
EVALUATE ('REGEXP_REPLACE(%1,%2,%3)',"PRODUCTS"."PROD_DESC",'[0-9]','')

Similar Messages

  • Extraction of Numbers from string in oracle

    Dear All,
    I have a AplhaNumeric field in my source table which holds the string with numbers and caharcters .i need to extract only numbers and to load into the target table which of number type.
    can any one suggest me about how to do this?
    regards
    kumar

    Hi ,
    I have a table called smitems with column smitmqtyremarks which holds alpha numeric characters .nearly 180 records exists in this table.
    i need extract numbers for this field and load into my target tables.
    here i am giving sample rows for this field :
    smitmqtyremarks
    13 قطعة
    4 لحاف
    31 قطعة
    120 قطعة
    57 قطعة
    110 قطعة
    127قطعة
    169 قطعة
    12 مفرش
    10 مفارش
    110 قطعة
    170 قطعة
    20 خرطوشة
    28 قطعة
    60قطعة
    70 قطعة
    80 لعبة
    70 قطعة
    20 قطعة
    60 قطعة
    50 قطعة
    10 رولات
    4 رولات
    35 دسته
    50دستة
    7 رول
    3 اثواب قماش
    خمسة خرطوشة سجائر
    50 جاكت حريمى ورجالى
    10 رول اقمشة 4 دسته
    420 جوارب اطفال
    60 خرطوشة سجائر
    12 رول
    15 خرطوشة
    110 علبة
    45 قطعة
    40 قطعة
    44 قطعة
    22 قطعة
    3 خرطوشة
    468 قطعة
    38 قطعة
    80 رول قماش
    2 رول
    6 رول اقمشة
    13 رول اجنبى الصنع
    100 دسته صينى الصنع
    18 رولات ملابس
    10دسته
    90قطعة
    33 قطعة
    39 قطعة
    42 قطعة
    300 ايشارب
    500 قطعة
    19000 ك 0ج
    607 قطعة
    24 قطعة
    45 قطعة
    40 اروسه
    5 رول اقمشة اجنبية الصنع
    75 قطعة
    5 قطعة
    4 رول
    26 قطعة
    50قطعة
    105 قطعة
    650 جرام
    65 قطعة
    50 خرطوشة
    4 خرطوشة
    80 قطعة
    100 بنطلون
    500 قطعة
    40 قطعة
    42قطعة
    1 خرطوشة
    14 قطعة
    80 قطعة
    7 خرطوشة سجائر
    230 لمبة
    50 قطعة
    50قطعة تليفون
    14 كرتونة
    4 كرتونة احذية
    17 كرتونة خزف
    22 لحاف
    16كرتونة ادوات صحية
    8كرتونة
    28 كرتونة
    2كرتونة
    15كرتونة
    115 قطعة
    6448
    1937قطعة
    1937 قطعة
    2628كجم
    6.980طن
    9 كرتونة
    18 شفاط
    صواميل حديد
    3كرتونة +20 قطعة
    39.480طن ق.غ سيارات
    25كرتونة مصنوعات خزفية
    50بنطلون
    8 كرتونة كلبسات
    20كرتونة اكسسوار حريمى
    279كرتونة لحوم
    38 اطار كاوتش
    10كرتونة
    4كرتونة
    10كيلو
    عدد5 ماكينات
    41سيارة
    سيارة
    90 قطعة ملابس
    22250كجم
    1793كجم
    1371كرتونة زجاج
    مستندى
    252شاشة
    5كرتونة
    320قطعة
    45خرطوشة
    98 قطعة
    10لفات
    25كجم
    320كجم
    5كراتين
    47طرد
    50قطعة
    117كجم
    1200 قطعة ملابس
    5كجم
    75جهاز
    40قطعة
    5كراتين
    10كجم
    250ق
    200ق
    200 توب
    20لفة
    30لفة
    2دستة
    95قطعة
    70قطعة
    57523طن طلمبات مياه
    43732كجم
    755كرتونة
    10.645طن
    1537طرد
    11751كجم
    مكبس
    77426.80متر
    2600قطعة
    339طن
    15120كجم
    مختلفة
    267طرد
    1200كجم
    189عبوة
    499كرتونة
    10000كجم
    960طرد
    15.770كجم
    111قطعة
    174طرد
    22000كجم
    473000علبة
    6720كجم
    145خرطوشة
    2500طن
    3660كجم
    27824كجم
    8682كجم
    14000كجم
    6400كجم
    133كرتونة
    2738كجم
    the characters are in arabic here.
    hope it clears my issue.
    please suggest me the right query for this to get only numbers
    thanks
    kumar

  • Truncate numbers from string field

    Afternoon all,
    This time I'd like to extract only 2 strings out of a string field. The field is of sales area which contains numbers and letters. For example, Scotland is given a number 01, West midlands is 02, Ireland however is given IR.
    however, the field which holds the information is like, 012, where 01 is the area number and 2 is type of area number.
    The information which we are interested in is first two strings.
    I have tried this in the formula given below but it doesn't work, it states a field is required
    If hasvalue({?Sales Area}) then
    totext(Minimum({slslsp.slr_slsperson}[1 to 2])) + " - " +
    totext(Maximum({slslsp.slr_slsperson}[1 to 2]))
    else
    "n/a"
    Should I be using a truncate and if yes then how?
    P.S. This is to show only the sales area number or text if selected under a parameter. The values of the parameter will stay the same. In other words it is just to show in the report.
    Many thanks once again
    Regards
    Jehanzeb

    Is it a range parameter? If so try this
    If hasvalue({?Sales Area}) then
    totext(Minimum({slslsp.slr_slsperson})[1 to 2]) + " - " +
    totext(Maximum({slslsp.slr_slsperson})[1 to 2])
    else
    "n/a"
    regards,
    Raghavendra.G
    Edited by: Raghavendra Gadhamsetty on Jan 16, 2009 4:16 PM

  • Parsing multiple digit numbers from string

    I have a string, specifically "Cups = 30" that I need to parse out "30" from. How can I do this? I've gone through tokenizing, it's dirivng me crazy!!

    This program will help you
    import java.util.*;
    class s21
    public static void main(String args[])
    try
    String s1="Cups=30";
    StringTokenizer st=new StringTokenizer(s1,"=");
    while(st.hasMoreTokens())
    st.nextToken();
    System.out.println(st.nextToken());//This statement will
    give 30 as output
    catch(Exception e)
    System.out.println(e);

  • Extract numbers from mixed string.

    How do I extract numbers from a mixed-character string?
    These are house numbers and I have some exceptions - examples below.
    How do I get rid of the letter/dash part, and keep the numeric part only?
    38A
    5600B
    23-A
    Thanks a lot.
    -John

    It does not work if you have a string like 3343S##@1~!234
    OP, you can try this:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> with t as(
      2      select '38A' c1 from dual union all
      3      select '5600B' from dual union all
      4      select '5Bas@#$%1SDf3ff`~7' from dual union all
      5      select '3343S##@1~!234' from dual union all
      6      select '23-A+9' from dual )
      7  --
      8  select c1,regexp_replace(c1,'[^[:digit:]]') only_num  from t;
    C1                 ONLY_NUM
    38A                38
    5600B              5600
    5Bas@#$%1SDf3ff`~7 5137
    3343S##@1~!234     33431234
    23-A+9             239
    SQL>

  • 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.

  • Grabbing numbers from an array of type double and outputting them into a text file

    In a program im creating i need to save some coordinates of a micropositioner i have into a text file,
    I have the coordinates saved into an array that has 6 digits of precision (6 places after the decimal point).
    I use the number to string conversion and wire that into the write to text file function in labview.  When i open the file
    the numbers that are only displayed are the ones to the left of the decimal point.  I know the number to decimal string function
    rounds the values so if i were to input 3.111111 it would only output the string "3" instead of "3.111111" . 
    So to get all the digits onto the file without rounding i multiplied the number by 10^6 but the decimal point will be lost at that point.
    Is there anyway i can convert numbers into strings without labview rounding to the nearest whole number also without having to multiply by 10^6 and without having to expect the user to know that the coordinates saved in a file are multiplied by an order of magnitude of a million ? 

    ed oh i guess i just missed that function on the pallete after i saw that the function went from number to hex, octal, etc. i assumed that the rest on that row would be some sort of conversion to a different base number, haha thanks.

  • How to retrieve Numbers from xml data

    if I have this data..
    <bids>
    <bid_tuple>
    <userid>U01</userid>
    <itemno>1004</itemno>
    <bid>40</bid>
    <bid_date>1999-03-05</bid_date>
    </bid_tuple>
    <bid_tuple>
    <userid>U03</userid>
    <itemno>1007</itemno>
    <bid>175</bid>
    <bid_date>1999-01-25</bid_date>
    </bid_tuple>
    <bid_tuple>
    <userid>U05</userid>
    <itemno>1007</itemno>
    <bid>200</bid>
    <bid_date>1999-02-08</bid_date>
    </bid_tuple>
    <bid_tuple>
    <userid>U04</userid>
    <itemno>1007</itemno>
    <bid>225</bid>
    <bid_date>1999-02-12</bid_date>
    </bid_tuple>
    </bids>
    stored in xmltype table called bids
    I want to run this query...
    select extract(OBJECT_VALUE,'/bids/bid_tuple/itemno/text()').getnumberval() from bids;
    it give me .. 1.0011E+63
    Which I DO NOT NEED
    I need numbers not string since extract or extract vlaue will return string AND using getNumberVal() will give me this strange result
    I need it since I want to compare the result with data from relational table
    Thanks

    NinaOracle wrote:
    select extract(OBJECT_VALUE,'/bids/bid_tuple/itemno/text()').getnumberval() from bids;That extracts and concatenates all itemno text nodes from the document into a single (possibly long) string.
    With getNumberVal you then try to convert the string to a (possibly big) number, hence the display "issue".
    If you want to break the XML into relational rows and columns, XMLTable is your choice :
    SQL> SELECT x.itemno
      2  FROM bids b,
      3       XMLTable(
      4        '/bids/bid_tuple/itemno'
      5        passing b.object_value
      6        columns
      7         itemno number path '.'
      8       ) x
      9  ;
        ITEMNO
          1004
          1007
          1007
          1007

  • How to gather a set of floating point numbers from a web page form?

    I am pretty new to Java and I am working on a project to apply Benfords law to find the probability of digits submitted by the user. My first step is to gather set of floating point numbers from a web page. How do I go about doing this? Any suggestion or a proper site where I can learn this stuff will be highly appreciated.

    I am using NetBeans IDE 5.5.1 and for this project. I have realized that the first question was not well phrased.
    I created a web project with 2 jsp files and a class file in it. When my jsp file runs I ask the user to enter a number for finding the probablility based on Benfords law.
    This is what I got so far:
    This is input.jsp
    <h1></h1>
    Please enter a number to be checked
    <form action="result.jsp" method="post">
    <input type="number" name="number" >
    <input type="submit" value="Check number">
    </form>
    </body>
    </html>
    This is result.jsp
    String number=request.getParameter("number");

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Convert from String to float

    How do I convert from String to float?

    Hi,
    you can use a Double for example - assuming value is that string to parse
    float f;
    try { Double d = new Double(value); f = d.floatValue(); }
    catch (NumberFormatException e) { f = 0.0; } // error - string value could not be parsed
    // here use your float fHope, that helps
    greetings Marsian
    P.S.: the Double class is usefull for that, because you also can get intValue(), doubleValue() or longValue() out of it for example. The StreamTokenizer for example parses numbers also only to double.

  • How do I avoid Error 85 in Scan From String scanning VISA read buffer?

    I have encountered an Error 85 with my Scan From String VI. I have a timed
    loop to read data from a device (flowmeter) using a serial port. This device takes
    periodic measurements and sends the reading which contains a numerical value to the serial port COM1. It cannot be read continuously, and the period
    between measurements may vary, so I decided a timed loop would be better than a while loop.
    The VI begins with VISA Configure Serial Port and then
    goes to a VISA Write which sends the message to the device to begin
    taking measurements. After this, the device usually says "TAKE FLOWMETER READINGS" to the terminal, thereafter only sending numbers. Then begins my timed loop containing VISA Read. I
    am taking the read buffer two places.
    First, I am taking it to an Array to Spreadsheet String with the
    Format String %.3f, as was in the Write to Text File example. Then I am
    using Concatenate Strings with this string and also a string containing
    the System Time. This string goes to Write to Text File, which I have
    configured using Open/Create/Replace File outside of the loop.
    Second, I am taking the read buffer to a waveform chart. I thought
    it would be a good idea to use Scan From String to convert the string
    into a DBL which I am then sending to the waveform
    chart.
    I am not sure if the initial "TAKE READINGS" message is giving me an error. I was able to get one reading saved to my text file from the device.
    Also the format string for my Scan From String is %.3f
    I am getting the Error 85 at the Scan From String only sometimes.
    When this happens, there is no data being written to the text file. But
    other times, I get data and it writes to the text file just fine (but
    rounds to nearest whole number).
    Any help would be greatly appreciated! This serial port device has been giving me a lot of trouble.

    Is this what you mean? Did I wire the shift registers correctly?
    I didn't know if you meant to Concatenate before Scan From String or Concantenate before or after VISA Read?
    Message Edited by YeungJohn on 11-20-2008 03:48 PM
    Message Edited by YeungJohn on 11-20-2008 03:49 PM
    Attachments:
    SerialShiftVI.JPG ‏87 KB

  • Cut text from string

    Hello. Is there any way I can cut text from string?
    I have responseResult variable which has value: {"success":true,"error":"No any errors."}
    I want >>No any errors. << text from that string variable.

    Like Varun suggested above, this text is JSON, and you can parse out the various values using JSON deserialising.
    If you just want to use standard string manipulation (which I wouldn't recommend unless this is the only string you want to 'cut up') you can use various combinations of string functions.
    For example, you could split the string at every double-quote mark:
    string jsonString = "{\"success\":true,\"error\":\"No any errors.\"}"; // initial string
    string[] strParts = jsonString.Split('\"'); // split string into an array of parts of the original separated at each double quote symbol
    string partINeed = strParts[5]; // get the specific part needed
    That's not a good way to do this in general (you should add proper JSON parsing), but for a single use it's OK. Note that you have to hard-code which piece of the string you're getting, which is not a safe approach.
    Also note I used "\" in those strings so I could incorporate double-quotes in the string.
    For more detailed string manipulation read up on RegEx. If you need to parse a lot of these strings in your app use JSON.
    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.
    Thank you guys. That solved my problem.

  • Parsing from string to int

    in my C# project I have an array type of String. the array gets numbers from type int.
    int numCell;
    string[] arr = new string[numCell];
    then i use it in a function like this:
    sum += int.Parse(arr[i]);
    and it works!
    but, when i dothe same thing in WPF it tells me:
    Input string was not in a correct format.
    what shouuld i do?

    Why did you mark your own question as answer? Please unmark it.
    >>if in C# it worked why wouldn't it work in wpf?
    As I have already mentioned, it is because of the actual value of arr[i]. It has nothing to do with Windows Forms or WPF but it is possible that your WPF application has put a different value in the array than your Windows Forms Application did. And if this
    specific value is not a valid number the parsing will always fail. So you should check the values that put into the array and probably use the int.TryParse method to do the parsing:
    int sum;
    if (!int.TryParse(arr[i], out sum))
    //the value of arr[i] was NOT a valid number...
    This will however not change the fact that for example the value "D1" cannot be converted to an int using the int.Parse or int.TryParse method.
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • Scan from string in pda

    Hello. 
    I work with LV 7.1, with the I Modul of PDA. 
    It doesn't work me 'Scan From String'. I have not found any contradiction because the pda doesn't accept it. 
    Does somebody know which the cause can be? As I can substitute it? 
    Thank you. 
    Greta
    Attachments:
    scan from string.JPG ‏6 KB

    Hello Greta
    The Scan from string function is supported in LV PDA but with some restrictions. The help file for LV PDA tells us:
    'The Format Into String function and the Scan From String function do not support changing the numeric separator (such as %#;). The Scan From String function does not support wildcard matches.'
    You are changing the numeric separator and this is not supported.
    Hope this helps
    BelenS

Maybe you are looking for

  • My default home page does not come up and my navigation bar is grayed out. I can't seem to fix it.

    In the last few days, I have noticed that when I open my browser, I don't get my default home page, even though it shows under my options. When I conduct a search, I have navigation buttons, but once I open a page from the search engine results page,

  • Partial Duplicate Downloads (Error 8003)

    One evening I set a TV series to download on my ATV. The next morning I noticed that episodes were down loading on my iMac. When that had finished, I had a complete series (and nothing else) on my Mac. However, when I return to my ATV as well as all

  • In Goods receipt PO  adding rows manually

    Hi, I am creating a new Goods receipt PO. After selecting vendor, Copying record from PO by clicking 'Copy From' Button. Row items are filling  in the First Row of the matrix. woks fine for me. Now the Issue is, I wanted to add second row in  after L

  • Process of Adobe Reader XI, is running in the Background, after closing.

    Hi, when I close the Adobe Reader XI, the Process is still running in the Background of my System. The Process needs a lot of CPU an after some moment my System is slowing down rapidly. Windows 8 (64-bit) Adobe Reader 11. What's to do? Greetings

  • Custom Jsp in Screen Flows

    I am trying to implement a screen using a custom jsp in a screenflow wthin studio 6.0. Following the documentation and examples with 5.7 I am using the Fuego tag library within a JSP to output a simple message variable. However I am currently unable