Problem on regular expressions

Hi all

I'm working on a project that require me to separate the following examples:

+ 0, + 0.0000 E1, - 4.33 + E1, - 4.222 + E1, - 6.33 + E2, - 6.55 + E2

What I need is the final four results separately:

-4.33 + E1.

-4.222 + E1,

-6.33_E2,

-6.55 + E2.

I'm totally cool regular expression. Any help is appreciated!

Thank you

+ Kunsheng

Hi, Kunsheng

Good evening exercise to learn regular expressions...

For example, quick and dirty:

I have the strong feeling that something's wrong here (I guess in ([0-9] + [1-9] +)), but in any case the above code is just starting point for you.

Andrey.

Tags: NI Software

Similar Questions

  • Problem with regular Expression

    Hello!!
    I have a problem with the regular expression. I want to validate only one word, and second are the same. To do this, I wrote a regex

    Model p=Pattern.compile("([a-z][a-zA-Z]*)\\s\1");
    Matcher m = p.matcher ("nikhil nikhil");
    Boolean t = m.matches ();
    If (t)
    System.out.println ("it's a game");
    on the other
    System.out.println ("is no match);

    The result I get is always 'there no match. "

    Your timely help will be very appreciated.

    Concerning

    Hello.

    You are missing a slash in the regex

    Pattern p = Pattern.compile("([a-z][a-zA-Z]*)\\s\\1");
    Matcher m = p.matcher("nikhil nikhil");
    boolean t = m.matches();
    if (t) {
        System.out.println("There is a match");
    } else {
        System.out.println("There is no match");
    }
    
  • problem of regular expression with brackets

    Hello

    I have a Zebra printer string that contains tokens that I want to search.

    ^ BY2, 3, 55 ^ FT50, 219 ^ BCN, Y, N... ^ FD >: [[number 1]] ^ FS
    ^ BY2, 3, 55 ^ FT525, 221 ^ BCN, Y, N... ^ FD >: [[serial number 2]] ^ FS
    ^ FT170, 192 ^ XG000. GRF, 1, 1 ^ FS
    ^ FT220, 430 ^ A0N, 27, 27 ^ FH\ ^ ea FD2. #00931 drum kit / ^ FS
    ↑ FT350, 460 ^ A0N, 27, 27 ^ FH\ ^ FD #00602 ^ FS
    ^ FO10, 32 ^ GB780, 480, 8 B, 1 ^ FS
    ^ FT720, 500 ^ A0N, 10, 10 ^ FH\ ^ FD [[Date Code]] ^ FS

    I want to find any instance of double hooks regardless of the bracketed text. I find [[SerialNumber 1]] for example, but I also want to analyze the entire string and ensure that there no case [[text]] left in the string. I was not able to build a regular expression that will find them.

    Hi elrathia,.

    Please find below screenshot

    Kind regards

    SrikrishnaNF

  • Build a regular expression for data series of Arduino.

    All,

    I have a few Arduinos Council integrated into a test configuration that I can't save the data of.  I now need to be able to see my data in real-time as it comes on the serial port.  I found a VI that seems like it should work, my problem is that I can't get a regular expression to work.

    The VI is not mine, but if I can get this working, I can easily put it in my VI.

    Here's my Arduino code; This is the timestamp, followed four data points, with delimiters tab. It prints on the serial port as

    190876 762314 814437 1108235 1091719

      Serial.print(sTime);
      //Serial.print(", ");
      Serial.print("\t");   
    
      data = getdata(dataRead);
      data = data>>4;
      Serial.print(data);
      //Serial.print(", ");
      Serial.print("\t");  
    
      data = getdata(dataRead1);
      data = data>>4;
      Serial.print(data);
      //Serial.print(", ");
      Serial.print("\t");  
    
      data = getdata(dataRead2);
      data = data>>4;
      Serial.print(data);
      //Serial.print(", ");
      Serial.print("\t");  
    
      data = getdata(dataRead3);
      data = data>>4;
      Serial.println(data);
    

    I think it is especially a problem with regular expression.  Any advice or pointers would be great.

    I wish there was a place where you just have to copy and paste my thong in and get a regular expression.

    Do not use bytes to the port!

    Take advantage of the termination character you have.  Activate it on the series set up and set it to the newline character.

    Now the VISA Read will wait until she has the entire line (or timeout if it does not).  Then you can analyze your data out there.

    I think the problem with your code, it's that you're looking for a backslash n.   Not a line break.  Turn it on the style of display of this constant and you will see it is fixed for normal display and backslash is no bar display.

  • regular expression replacement


    Hi gurus,

    I have a requirement where I have to replace some characters in duplicate and retain the values of this column in order of alphabatic and digital control. Please find below examples of data

    Thanks in advance

    sample data:

    SELECT 'ZZYYXXAAABBBDDDCCC' DOUBLE COL1

    UNION ALL

    SELECT 'DDDCCCAAA' OF THE DOUBLE

    UNION ALL

    SELECT 'SDBBACCCC' OF THE DOUBLE

    UNION ALL

    SELECT "99988866332154" DOUBLE

    UNION ALL

    SELECT "77663322996" DOUBLE

    Expected:

    ABCDXYZ

    ADC

    ABCD

    12345689

    23679

    Hello

    I don't think that regular expressions will help with that.

    Here's a way to do it:

    WITH single_characters AS

    (

    SELECT DISTINCT

    col1

    , SUBSTR (col1, LEVEL 1) AS a_char

    OF sample_data

    CONNECT BY LEVEL<= length="">

    AND PRIOR col1 = col1

    AND PRIOR SYS_GUID () IS NOT NULL

    )

    SELECT LISTAGG (a_char) WITHIN GROUP (ORDER BY a_char) AS expected

    OF single_characters

    GROUP BY col1

    ;

    This assumes that col1 is unique.  If this is not the case, use all that is unique, even something drift of ROWID or ROWNUM, in CONNECT BY and GROUP BY clauses.

    The output I get is exactly what you posted:

    EXPECTED

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

    23679

    12345689

    ACD

    ABCD

    ABCDXYZ

    I guess that's what you really want.

    Regular expressions can not re - organize a string so that the characters are in order; you need to split the string into pieces, order parts and then put back together them.  Given that you have to do it just to get the characters in order, it's simple remove duplicates without problem with regular expressions.

  • the simple regular expression problem

    Hello

    I need assistance with regular expressions. I have a situation when I need to get data from one table to the other and I think that my problem can be solved using REG EXP, but I don't know how to use them properly.


    I need to separate fileld varchar2 which is basically number/number in 2 separate number fields
     
    
    
    CREATE TABLE tst (CODE VARCHAR2(10)); 
    
    INSERT INTO tst VALUES('10/15'); 
    INSERT INTO tst VALUES('13/12'); 
    INSERT INTO tst VALUES('30'); 
    INSERT INTO tst VALUES('15'); 
    
    CREATE TABLE tst2 (po NUMBER, co NUMBER); 
    I need to get the code in the co and po columns. I think the result should look something like this, but:
     
    
    INSERT INTO tst2 
    SELECT regexp_substr(CODE 'something here to get the number before /') AS po, 
           regexpr_substr(CODE 'something here to get number after') AS co 
    FROM tst;   
    Any help appreciated

    Agree with the above,

    However, if you really want to know how to do with regular expressions you can do it like this...

    SQL> select regexp_substr('10/15','[^/]+',1,1) from dual;
    
    RE
    --
    10
    
    SQL> select regexp_substr('10/15','[^/]+',1,2) from dual;
    
    RE
    --
    15
    
  • Regular expressions - problem

    Hi @ all,

    I need a regular expression more difficult, I don't know Don t.

    I have a big file with many pages .htm (800-1000) and I have to do the following:

    http://www.domain.de/ AB % 32-xyz? myshop = 123

    I have to delete the "ab % 32-xyz", the problem is, that it is, it could be each symbol, the letter or digit.

    Then the area between " " http://www.domain.de/ ' 'and'? myshop = 123 "(these 2 areas are identical in all documents each time) should be removed.

    Anyone could tell me how to do this with regular expressions in dreamweaver?

    Thank you

    Felix

    P.S.: Sorry, my English is not so good, I m from the Germany

    You want to replace the random text with anything?

    If this is not the case, this is how you do in DW:

    1. Make a backup of the folder that you want to change, just in case something goes wrong
    2. Edition > search and replace
    3. In the find and Replace dialog box, select the folder in the menu drop-down "search in" and select the folder that you want to use.
    4. Select the Source Code from the drop-down search menu.
    5. Place the following code in the search text box:
      (http://www \.domain\.de/) [^?] +(\? MYshop = 123)
    6. Place the following code in the text box replace:
      $1$ 2
    7. In Options, select the checkbox "use regular expression.
    8. Click on replace all. Dreamweaver warns you that the operation cannot be undone in pages that are not currently open. As long as you have made a backup, click OK to run the operation.
  • Chain problem: not being able to escape a bracket for a possible regular expression

    So, I have barely any idea of how to use regular expressions except a little knowledge of it in PHP.

    What I'm trying to do is to separate the first part of a string of qualifier, so I need a regular expression since ideally I wish I could. The problem I have is that my attempt of separation does not work. I tried to do what I think the model or class Matcher, I tried to use String.split, and I tried using the regular String.replace method. What I'm trying to do is illustrated (I hope) in the following NBS:
    public class SSCCE
    {
        public static void main(final String args[])
        {
            final String testString = "I want to keep this sentence. (I wish to "+
                "discard this sentence and the space in between the sentences.)";
            final String testExtract = testString.replace(" \(.+\)","");
            System.out.println(testExtract);
        }
    }
    From my understanding, the parentheses are supposed to be a wild card of sorts, so they would need to be escaped in order to be taken as a literal, which means that line 7 is supposed to correspond to any of the characters inside the brackets where the opening is preceded by a space and then delete them. The problem I have is that escaping brackets generates an error and does not escape their product the original string. So I don't know how to tell Java I use actually literal parentheses.

    I tried to configure my preferences of error to ignore everything, but it does not work.

    I don't know if it's important, but I use Java 1.6 and Eclipse for PHP 1.3.2.20110218 - 0812.

    rp0428 wrote:
    Shouldn't be using replaceAll if you use a regular expression?

    http://docs.Oracle.com/javase/6/docs/API/Java/lang/string.html

    and, on the assumption that you actually use a replaceAll(), you need to escape to the '-' characters as they are themselves i.e. Java escape characters

    " \\(.+\\)"
    

    In addition, the use of ".". +"can lead lead to important feedback. In this simple example you probably won't notice it, but in general, you'd better avoid the return back by using the reluctant modifier or by replacing the '.' by a character set that does not include the character terminal.

  • Regular Expression Validator problem

    Hello
    I have a text box that I want to use a regular expression validator to check that one or more 9 char alphanumeric serial numbers have been entered.
    < mx:RegExpValidator
    source = "{entryField}.
    property = "text".
    Flags = "IM".
    expression="{/[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9] ({|, | \\n|\\r|\\t)/} ')
    valid = "handleResult (Event)" "
    Invalid = "handleResult (Event)" "
    trigger = "{entryField}.
    triggerEvent = "textInput".
    / >

    for the test
    private void handleResult(eventObj:ValidationResultEvent):void {}
    If (eventObj.type is ValidationResultEvent.VALID)
    {
    entryField.setStyle ("borderColor", "green");
    entryField.setStyle ("largeurBordure", "2");
    }
    on the other
    {
    entryField.setStyle ("borderColor", "red");
    entryField.setStyle ("largeurBordure", "2");
    }
    }

    The problem is the handler function always comes back valid, even when it must be valid, as: 123456789 a12345678 lk231jkop

    Can anyone tell where I go wrong? Thank you!

    I finally got it works like this:
    triggerEvent = "keyUp".
    expression = "^ ([A-Za-z0-9] {9} \ (|, |))" \n|\r)*)+$ »

    The big takeaway from this is that the textInput event does NOT work as advertised. Specifically, it does not occur during a deletion. In addition, it forces me to add a space at the end of a serial number using the above expression so that the validation is successful. Fortunately, 'keyUp' works very well :-)

  • The regular expression problem

    Dear friends,

    In my script I have some sections that test the contents of an edit field before it is processed further.

    Perfectly things like the following:

    var re_Def = /#[A-Za-z][A-Za-z0-9_]+/;          // valid variable name ?
    items = ["#correct", "notcorrect", "#This_is4", "#thisIs", "@something", "#ALLOK", "", ];
    // search    0            -1          -1!!        -1!!          -1        -1!!     -1      <--- incorrect method
    // test    true         false         true        true        false       true    false    <--- correct method
    for (var j = 0; j < items.length; j++) {
      var item = items[j];
      alert ("'" + item + "' ==> " +  item.search(re_Def) + "\n" + re_Def.test(item));
    }
    var re_Def = /(\[ROW +\d+\]|\[COL +\d+\]|\[CELL +\d+, +\d+\]|Left *\(\d*\)|Right *\(\d*\)|Above *\(\d*\)|Below *\(\d*\))/;
    items = ["[ROW 17]", "[Row n]", "[ROW n]", "[CELL 3, 9]", "[CELL 3 9]", "Abbove()", "Right(3)"];
    // result  true        false      false         true         false        false         true    
    for (var j = 0; j < items.length; j++) {
      alert ("'" + items[j] + "' ==> " +  re_Def.test(items[j]));
    }
    

    But what follows always returns false, independly of the content of the string element:

    var re_Def = /{[EFJ]\d*}|{I}/;    // valid format def?
    var item = "{E27}";
    var result = re_Def.test(item);
    alert (result);                   // false !!
    

    RegEx buddy told me, that
    -l' REGULAR expression is correct
    -the result must be true, not false

    -The verbose definition of the RegEx is:
    Match is the following regular expression (attempting the next alternative only if this one fails) "{\d* [EYF]}."
    Match the character "{" literally "{}".
    Match a single character present in the list "J" "[EYF]."
    Match a single digit 0. 9 paper"\d*»
    Between zero and unlimited times, as many times as possible, giving as needed (greedy) «*»
    Match the character "}" literally "}".
    Or match number 2 below (the entire match attempt fails if it cannot match) regular expression "{i}".
    Match the characters "{i}" literally "{i}".

    Typo unrecognized? Test the faulty method?

    Results are fake, as soon as I use the list of characters []] - but look at the first block of code: there are also lists of character they are treated properly.

    The braces in the regular expression must be escaped to be taken literally:

    var re_Def = /\{[EFJ]\d*\}/;
    

    Kind regards

    JoH

  • problem of the regular expression?

    Hi I have a file that contains the following text

    < cfset objNews.strNewsTickerLink = "index.cfm? pageid = 83" >

    Now what I want to do is to scrape the value of this variable for example "index.cfm? pageid = 83. Now, this variable can be different... so basically regardless of the value of the variable objNews.strNewsTickerLink is on... I want to get it out. Now, I'm not that great with regular expressions... can someone help me?

    THX

    Thank you... but I found a even better who does the work for me

    http://CFLib.org/UDF/GetContainer

  • problem with the validation type: regular expression

    Hi all
    I have a text field element call p40_opt
    in the past, this element could accept only the values 1-9
    I made a posting type: regular expression
    1 validation expression:
    p40_opt

    2 validation expression:
    [1-9]

    works very well.

    Today, I wanted to add an option that p40_opt can also contains the value: 10
    so I changed the range [1-10].

    and now, it's not good because if I choose another option plus 1 and 10 to Ant

    he do the validation.

    what I'm missing here?
    Thanks in advance

    Under the direction of: naama on August 6, 2009 01:31

    The forum software has mutilated regular expressions in your message. You should edit, wrapping up the regular expressions in.

     tags so they are properly displayed.
    

    ^ [1-9] {1} $. ^ $ 10

    would be one regular expression that performs the required validation, however a regular expression doesn't appear to be the most straightforward way to validate such a range of values. A SQL or PL/SQL validation would be clearer, using the expression:
    

    : p40_opt between 1 and 10

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • regular expression for alarm url

    Hello

    I have a problem with the regular expression. I want to filter only the name of a dsc alarm url: \\EW-MONITOR\monitor\000_t-ist_STB-M1-AS. Alarms.HI must be 000_t-ist_STB-M1-AS. Someone has a tip for me?

    Best regards

    --
    Joachim

    If as jcarmody asked, the name will always be between 'monitor\' and '. '. Alarms"use the output matching sub regular expression corresponds to

     

    It takes the name from alam of the entire game.

  • Regular expression matching is not what matches Pattern

    I read a lot of posts on how match model does not match what match regular expressions will be due some characters does not.

    However, I found a problem with the other way. A simple Reg - Ex who works in the match pattern but not regular Expression match.

    What I have here is just an example. I want to use regular Expression Match then I can specify some matches under.

    The reg - ex's: one or more non-numeric characters, a space, one or more numeric characters. At the beginning of the string.

    How can I get this to work in regular expression matching? I work in LabVIEW 2010f2 32 bit. Here is the code snippet and the results:

    Rob

    One of the subtle differences is the operator of negation for the character classes.  In match pattern is ~, but for the Match RegEx is ^.

  • Allow specific characters - Regular Expression

    Hello everyone

    I am new to the regular expression and I have a very simple question. I use the function "read from the text file" to load a file delimited by tabs with 3 columns in my VI. Then, the string is converted to table and I use the values.

    Nevertheless, I would like to develop a "filter" that allows only digits (0-9), colon, comma , and point to strings.

    Using the function "matches regular expression", I tried a regular expression like this:

    [^ 0-9] | [^\]. [|^:]| [^,]

    But it does not work.

    Could someone help me with this problem?

    Thank you

    Dan07

    Use search and replace with regular Expression String selected.

Maybe you are looking for

  • ICS Atrix WebTop

    Just curious, is the new WebTop (ICS) environment is related to http://www.Ubuntu.com/devices/Android and to this http://www.pcpro.co.UK/News/373024/canonical-puts-Ubuntu-on-Android-smartphones or is a custom solution Motorola?

  • The upgrade of dv6565en Pavilion

    Hello Is it possible to evan... I want to upgrade the processor (currently AMD Turion X 2 TL-58) and graphics (currently nVidia GeForce 8400 GS). What are my options... If any.

  • Pavilion dv6t-7000 QE: upgrade factory ssd for the four edition dv6t-7000

    I have a laptop DV6T - 7000 CTO Quad Edition, 64-bit Windows 7, I had configured with a 160 GB SSD from the factory.  It works great, very fast, but I want to move to a larger ssd. In looking at a crucial or sandisk pro now, 480 GB or more. My questi

  • DF bit value IP sla icmp

    I want to put a mechanism to control the reachbility between two nodes by using the property intellectual ALS, but I find no definition df bit for ip sla icmp packets, y at - it ideas to do? Best regards.

  • Click with the right button on failure

    Im trying to run programs as administrator.when I click with the right button on the laptop keys or mouse nothing happens.no list, nothing.like its been completely disabled. IM the only user and admin. The only changes ive done what anyone recently h