Split a string using Match Pattern function

I am trying to split a response string from a climate chamber into different parts. The string goes something like this: 0030.0\s0034.6\s0080.0\s0083.4. I am using the match pattern function to split the string using \s as the search string. But it is not splitting the string as required. If I use only \ , its working fine. Can anyone please suggest why \s is not being recognised as a part of the input string?
Subhro.
Solved!
Go to Solution.

Is the string you show in normal display mode or in \ codes display mode?
Anyway, if you need to match a '\' character you'll have to mask it using \, so the match string would be '\\s' to match '\s'.
Alternatively you could use spreadsheet string to array with the correct delimiter. For the data you show this would work perfectly.

Similar Messages

  • How do I use the Match Pattern Function to exclude only 0.000?

    Hi,
    I'm trying to use the mattch pattern function to find the first string in a table thats is >0. My table looks like:
    1,0.000000,0.000 %2007/01/13 00:16:19 196281
    1,0.000000,0.000 %2007/01/13 00:16:22 196282
    1,0.831262,0.000 %2007/01/13 00:17:20 196375
    2,0.811154,0.000 %2007/01/13 00:17:20 196375
    If I us the paremeter "1,[~0]" It doesn't find the line 1,0.831262,0.000... which is the one that I want. I also tried :1,[0-9].+[~0] and that didn't work either. the problem is that the first digit after to 1, isn't allways going to go from 0 to 0.0 sometimes it might go from 0 to 2.??.
    Thanks for the help
    Matt

    "Matt361" <[email protected]> wrote in message news:[email protected]..
    Hi,
    &nbsp;
    I'm trying to use the mattch pattern function to find the first string in a table thats is &gt;0. My table looks like:
    1,0.000000,0.000 %2007/01/13 00:16:19 196281
    1,0.000000,0.000 %2007/01/13 00:16:22 196282
    1,0.831262,0.000 %2007/01/13 00:17:20 196375
    2,0.811154,0.000 %2007/01/13 00:17:20 196375
    If I us the paremeter "1,[~0]" It doesn't find the line 1,0.831262,0.000... which is the one that I want. I also tried :1,[0-9].+[~0] and that didn't work either. the problem is that the first digit after to 1, isn't allways going to go from 0 to 0.0 sometimes it might go from 0 to 2.??.
    &nbsp;
    Thanks for the help
    Matt
    &nbsp;
    Hi,
    1,[~0] matches a "1" a "," and then any character that is not "0".
    1,[0-9].+[~0] matches a "1" a "," and then any character that is "0-9", any number of anything!! (1 or more) and then anything that is not "0". Note that you have to escape a . to match a ".". Like this "\.".
    There is no way to check if there is anything other then a "0" in the match, from within the match pattern function. So I think you won't be able to find a pattern that does the trick.
    Why not use a whileloop to find the first item? Or use the Spreadsheet String To Array, and then compare the desired row or column with the string "0.000000"? (Or replace all ,0.000000, by a string like ",NULL,", then match the pattern?)
    In LabVIEW 8 there is a new Match Regular Expression function. Haven't tried it, but it should be much more powerfull then the Match Pattern function. But also much more complex.
    Regards,
    Wiebe.

  • Match hex 00 or NULL with Match pattern function

    Hi, I am using Match pattern funciton to match NULL character and 0000 character in a string (hex display).
    Someone told mu use the following regular expression:
    ^[\00]*, and [\00]*$ , and he said:
                    \00 is Hex 00
                    \0 un-defined
    But I read some stuffs about regular  expression that \0x00 is Hex 00, \00 is Octal 000.I want to know what meaning the \00 is.
    Please refer to the attached trim00.vi.
    Solved!
    Go to Solution.
    Attachments:
    trim00.vi ‏7 KB
    trim00.vi ‏7 KB

    Match Pattern and Match Regular Expression are two different functions. With Match Pattern the string ^[\00]* matches any number of null characters starting at the beginning of the string, while the string [\00]*$ matches any number of null characters starting at the end of the string. Check the help for the Match Pattern function for more info.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Need Help in Splitting a String Using SQL QUERY

    Hi,
    I need help in splitting a string using a SQL Query:
    String IS:
    AFTER PAINT.ACOUSTICAL.1..9'' MEMBRAIN'I would like to seperate this string into multiple lines using the delimeter .(dot)
    Sample Output should look like:
    SNO       STRING
    1            AFTER PAINT
    2            ACOUSTICAL
    3            1
    4            
    5            9" MEMBRAIN
    {code}
    FYI i am using Oracle 9.2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    There's this as well:
    with x as ( --generating sample data:
               select 'AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN' str from dual union all
               select 'BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN' str from dual)
    select str,
           row_number() over (partition by str order by rownum) s_no,
           cast(dbms_xmlgen.convert(t.column_value.extract('//text()').getstringval(),1) as varchar2(100)) res
    from x,
         table(xmlsequence(xmltype('<x><x>' || replace(str,'.','</x><x>') || '</x></x>').extract('//x/*'))) t;
    STR                                                S_NO RES                                                                                                
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 1 AFTER PAINT                                                                                        
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 2 ACOUSTICAL                                                                                         
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 3 1                                                                                                  
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 4                                                                                                    
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 5 9" MEMBRAIN                                                                                        
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          1 BEFORE PAINT                                                                                       
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          2 ELECTRIC                                                                                           
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          3 2                                                                                                  
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          4                                                                                                    
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          5 45 caliber MEMBRAIN      
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to split a string using IndexOf?

    How would you split a string using indexOf and not using the .split method?
    Any help is appreciated :D
    Message was edited by:
    billiejoe

    would it be better to use the first or the second?
    int      indexOf(int ch)
    Returns the index within this string of the first occurrence of the specified character.
    int      indexOf(int ch, int fromIndex)
    Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
    I think the second would be helpful. so how do i read it?

  • How to Split the string using Substr and instr using loop condition

    Hi every body,
    I have below requirement.
    I need to split the string and append with single quotes('') followed by , (comma) and reassign entire values into another variable. so that i can use it where clause of update statement
    for example I am reciveing value as follows
    ALN varchar2(2000):=(12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434);
    Note: In the above variable i see 8 transactions, where as in real scenario i donot how many transaction i may recive.
    after modification i need above transactions should in below format
    ALTR Varchar2(2000):=('12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434');
    kindly help how to use substr and instr in normal loop or for loop or while loop while modifying the above transactions.
    Please help me to sort out this issue.
    Many Thanks.
    Edited by: user627525 on Dec 15, 2011 11:49 AM

    Try this - may not be the best way but...:
    create or replace type myTableType as table of varchar2(255)
    declare
    v_array mytabletype;
    v_new_str varchar2(4000);
    function str2tbl
             (p_str   in varchar2,
              p_delim in varchar2 default '.')
             return      myTableType
        as
            l_str        long default p_str || p_delim;
             l_n        number;
             l_data     myTableType := myTabletype();
        begin
            loop
                l_n := instr( l_str, p_delim );
                exit when (nvl(l_n,0) = 0);
                l_data.extend;
                l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
                l_str := substr( l_str, l_n+length(p_delim) );
            end loop;
            return l_data;
       end;
    begin
      v_array := str2tbl ('12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434', ',');
          FOR i IN 1 .. v_array.COUNT LOOP
             v_new_str := v_new_str || ''''||v_array(i)||'''' || ',';
          END LOOP;
       dbms_output.put_line(RTRIM(v_new_str, ','));
    end;  
    OUTPUT:
    =======
    '12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434'HTH
    Edited by: user130038 on Dec 15, 2011 12:11 PM

  • How to split a string using sql

    Hi All,
    I've to write a query where I need to split a string, how this can be done? So let's say a column has value as 1,2,3,4,5 and I want to split this string and output it as:
    1
    2
    3
    4
    5
    Please advise.

    Lots of articles:
    Snap this user defined function too:
    CREATE FUNCTION [dbo].[ufn_SplitString_Separator](@InputStr VARCHAR(MAX), @Separator VARCHAR(1))
    RETURNS @tmpTable TABLE (OutputStr VARCHAR(MAX))
    AS BEGIN
    DECLARE @TmpPOS integer
    SET @TmpPOS = CHARINDEX(@Separator,@InputStr)
    WHILE @TmpPos > 0 BEGIN
    IF @TmpPos > 0 BEGIN
    INSERT INTO @tmpTable VALUES (LTRIM(RTRIM(SUBSTRING(@InputStr,1,@TmpPos-1))))
    SET @InputStr = SUBSTRING(@InputStr, @TmpPOS + 1, LEN(@InputStr) - @TmpPos)
    SET @TmpPOS = CHARINDEX(@Separator,@InputStr)
    END ELSE BEGIN
    INSERT INTO @tmpTable VALUES (LTRIM(RTRIM(@InputStr)))
    SET @TmpPos = 0
    END
    END
    IF LEN(@InputStr) > 0 BEGIN
    INSERT INTO @tmpTable VALUES (LTRIM(RTRIM(@InputStr)))
    END
    RETURN
    END
    GO
    And you can use like this:
    SELECT * FROM DBO.[ufn_SplitString_Separator]('1,2,3,4,5',',')
    "If there's nothing wrong with me, maybe there's something wrong with the universe!"

  • Splitting out string, using the results to lookup reference, then returning the reference name as a string?

    I have a field that contains a comma separated string of sys_id’s that relate to another table.
    I am trying to write a query that returns the name value from the reference table, so that the result is a comma separated string of the name field.
    Can anyone help with the SQL required to split out the sys_id’s, do the look-up and return the names back into a string?
    Table1
    Number
    Category
    1001
    Sys_id1, Sys_id3, Sys_id9
    1002
    Sys_id3
    1003
    Sys_id4,Sys_3
    1004
    Sys_id1, Sys_id9, Sys_id10, Sys_id6
    Category Reference Table
    Category Sys_id
    Category_Name
    Sys_id1
    Consulting
    Sys_id3
    Negotiate
    Sys_id4
    Planning
    Sys_id6
    Building
    Sys_id9
    Receipt
    Sys_id10
    Complete
    The result I am looking for would be.
    Number
    Category
    1001
    Consulting, Negotiate, Receipt
    1002
    Negotiate
    1003
    Planning, Negotiate
    1004
    Consulting, Receipt, Complete, Building

    I am not going to arguee regarding your model, but you should consider normalizing it.
    The idea is to have a function to split the string and return a row for each element in the list. Dump the result into a table and then use FOR XML PATH to do the string aggregation.
    To learn about different methods you could use to create the split function refer to this article.
    Arrays and Lists in SQL Server
    http://www.sommarskog.se/arrays-in-sql.html
    Here is an example using XML methods. This is just an example and it doesn't deal with proper indexing, weird characters as part of the list that can't be translated as xml, etc.
    SET NOCOUNT ON;
    USE tempdb;
    GO
    DECLARE @T TABLE (
    Number int,
    Category varchar(50)
    INSERT INTO @T (Number, Category)
    VALUES
    (1001, 'Sys_id1, Sys_id3, Sys_id9'),
    (1002, 'Sys_id3'),
    (1003, 'Sys_id4, Sys_id3'),
    (1004, 'Sys_id1, Sys_id9, Sys_id10, Sys_id6');
    DECLARE @R TABLE (
    Sys_id varchar(15),
    Category_Name varchar(35)
    INSERT INTO @R (Sys_id, Category_Name)
    VALUES
    ('Sys_id1', 'Consulting'),
    ('Sys_id3', 'Negotiate'),
    ('Sys_id4', 'Planning'),
    ('Sys_id6', 'Building'),
    ('Sys_id9', 'Receipt'),
    ('Sys_id10', ' Complete');
    DECLARE @W TABLE (
    Number int,
    pos int,
    Sys_id varchar(15),
    PRIMARY KEY (Number, Sys_id)
    INSERT INTO @W (Number, pos, Sys_id)
    SELECT
    A.Number,
    ROW_NUMBER() OVER(PARTITION BY A.Number ORDER BY N.x) AS pos,
    N.x.value('(text())[1]', 'varchar(15)') AS Sys_id
    FROM
    @T AS A
    CROSS APPLY
    (SELECT A.Category AS [text()] FOR XML PATH('')) AS B(c)
    CROSS APPLY
    (SELECT CAST('<l>' + REPLACE(B.c, ', ', '</l><l>') + '</l>' AS xml)) AS C(x)
    CROSS APPLY
    C.x.nodes('/l') AS N(x);
    SELECT
    A.Number,
    STUFF(
    SELECT
    ', ' + C.Category_Name
    FROM
    @W AS B
    INNER JOIN
    @R AS C
    ON C.Sys_id = B.Sys_id
    WHERE
    B.Number = A.Number
    ORDER BY
    B.pos
    FOR XML PATH(''), TYPE
    ).value('(text())[1]', 'varchar(MAX)'), 1, 2, '') AS Category
    FROM
    @T AS A;
    GO
    AMB
    Some guidelines for posting questions...

  • Split a String using a point like Regex

    I want to use the method split from the class String with the character "." bat, it doesn't rules... I have try using the character hexadecimal code '\u002E' bat doesn't works.
    I need to divide a IP adress cutting for the points;
    84.241.254.1 => 84 241 254 1
    Thanks for all

    It is more efficient to just parse it yourself.
    But anyways you can use one of the following regexes.
    Naturally with the second you will have to escape the backslash when you use it in a java string.

  • How to "split" a string using API 1.3?

    Hi everyone,
    I'm needing to split strings at the slash "/" character.
    Unfortunately, we're using API 1.3, and according to the API, "split" isn't available until 1.4.
    I'm looking for suggestions, help, examples, or alternatives.
    Thanks!

    How about StringTokenizer?

  • Wrong result in match pattern

    Hi, I want to extract the space (sometimes, !#" etc) from "@020 12345' using match pattern function.
    When I used [\s!#"] as a regular expression, the result "20".
    Why my expression is not worked and Can you propose more suitable expression?
    labmaster 
    *)Enclosed is the VI example in LV2009
    Solved!
    Go to Solution.
    Attachments:
    yahoo.vi ‏7 KB

    labmaster wrote:
    Hi, I want to extract the space (sometimes, !#" etc) from "@020 12345' using match pattern function.
    You should also describe what you mean by "extract". If you simply need a space, you can use a space diagram constant. No need to extract it. Do you want the resulting string without the space, for example?
    I am sure one of the regex gurus here will jump right on this one...
    LabVIEW Champion . Do more with less code and in less time .

  • How to split a string for 2 different matching patterns?

    hey guys
    i'm trying to split a string, using .split(regular expression), if two different pattern matches but i don't know the exact syntax for it. I want to split the string from letters and punctuations.
    This is what i'm doing, obviously it's not working, i'm not too sure if syntax are correct.
    String inputDigit [] = input.split("([a-zA-Z]) (\\p{Punct})");Please help me with this, thank you!

    Can you describe in more detail what you're trying to
    accomplish?ok, basically if you have a string which consists of letters, digits and punctuations. All i'm trying to do or want to do is store all digist within that string into an array. Therefore, i'm using split method to split the string wherever you find a letter or a punctuation. But i don't know what is syntax for using two different patterns at the same time.
    // For example if you have a string "Eeyore 61 2.986PoohPiglet007Kanga-23"
    // i only want: 61 2 986 007 23. I know i can use substring // but that would be a slightly long process

  • Regular Expression for Match Pattern (string) Function

    I need to find a variable length string enclosed by brackets and
    within a string. Can't seem to get the regular expression right for
    the Match Pattern function. I'm able to get the job done using the
    Token function, but it's not as slick or tight as I'd like. Does
    anybody out there have the expression for this?

    Jean-Pierre Drolet wrote in message news:<[email protected]>...
    > The regular expression is "\[[~\]]*\]" which means:
    > look for a bracket "\[" (\ is the escape char)
    > followed by a string not containing a closing bracket "[~\]]*"
    > followed by a closing bracket "\]". The match string include the
    > brackets
    >
    > You can also read "Scan from String" with the following format:
    > "%[^\[]\[%[^\[\]]" and read the 2nd output. The brackets are removed
    > from the scanned string.
    Thanks, Jean_Pierre
    I did some more experimenting after posting and found that \[.*\] also
    works with the match pattern function. Thanks for your input.
    sm

  • Match Pattern does not function properly when searching for a null character

    I'm using Match Pattern to extract a null terminated string from a response I'm getting from a device on a serial port. The VI is attached and below is a screenshot of the block diagram.
    It works just fine with index set to 0, 1, or 2. When index is 3, I get the output shown below.
    Why is Match Pattern not finding the null character?
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    Grab Nullterm String.vi ‏15 KB

    I'm a dope, need to remove the wire from the Offset control to the Match Pattern control.
    DUH!

  • Match pattern: change regular expression search via front panel?

    Hello,
    I have an application that I am developing which is making use of Serial VISA.
    I am scanning the output of a serial port which is constantly spitting out a long string of data. 
    Data is being pulled from the string with several combinations of SCAN FROM STRING functions and MATCH PATTERN Functions.
    Question:
    How can I use a button or TEXT box on the FRONT PANEL that can change the MATCH PATTERN Functions Regular expression?  
    for example the string may spit out the following:
     Weight\s\s\s\s\s\s\s\s\s\s\s\s-0.00\slb\s\s\s\s\s\s-16\sbits\s+74.40\s\B0F\sCorrected\s\s\s\s\s\s-0.00\slb\s+0.999987\s%\s\r
    in this case the serial device is spitting out data in LB.
    It could be possible for the device to spit out data in KG ... thus I need to change the REGULAR EXPRESSION.
    Thank you for your time

    Hi,
    just a quick example.
    there are other way of doing this but I think the ComboBox is quite an easy one.
    hope this helps
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    ComboBox.vi ‏12 KB

Maybe you are looking for

  • Video no longer plays on iPad 2 with iOS 8.3

    I used to watch videos using the Apple Trailers app, YouTube, CBS and ABC apps.  After the iOS 8.3 update, none of them will play videos anymore.  They all basically indicate they cannot connect to the source server.  Some of them even state my iPad

  • When i press the firefox button it trying to start but then it fails and then in the task maneger it is running. pls help me, this is a big problem for me.

    When I try to start firefox it starts to open but then suddenly dies everything. it appears in Task Manager that it is running. I have tried everything but nothing works. so please help me fix this problem so I can continue to use firefox.

  • Customized Web Form

    Hi, I have Scenario dim (Plan, Forecast) in Page and Year and Period in Columns (these two are placed in separate columns). I am now needed to show only Thisyear (Column A) or NextYear (Column B) based on the scenario selection in the page and click

  • Suggest me a small J2EE Project

    I want to do my MS project in j2ee using EJBs, JSPs, servlets and xml etc. I have some familiarity with all of these. Can someone suggest me a project that requires an effort of around 60 days of one person.

  • System requirements for CS6

    Have a look at the new system requirements page: http://www.adobe.com/products/premiere/tech-specs.html In the past, a legitimate criticism of the system requirements on the box (and on that page) was that they were just the bare minimum for running