Matching Regular Expressions in OBPM 10GR3

Hi all,
How do I match Regular expressions like" Wait For Response" in Strings using OBPM?
Any idea?
Is there any exact syntax?
Because I tried doing this:-
for( int i=0; i < testGroup.length(); i++)
     if(testGroup.reason.match(regexp : "Wait For Response"))
          logMessage("--Test Group Matched--");
But it does not work..
Any idea?

String myVar = "has matching_char_set";
if ( myVar.match(regexp : '/matching_char_set/') ) {
logMessage("matched...yep");
Try like this ..should work.
Rgds,
Biltu

Similar Messages

  • Match Regular Expression does not match what Match Pattern does

    I have read through a lot of posts about how Match Pattern does not match what Match Regular Expression will due to not processing some characters.
    However, I found a problem with the other way. A simple Reg-Ex that works in Match Pattern but not Match Regular Expression.
    What I have here is just an example. I want to use Match Regular Expression so I can specify some sub-matches.
    The reg-ex is for: one or more non-numeric characters, a space, one or more numeric characters. At the start of the string.
    How can I get this working in Match Regular Expression? I am working in LabVIEW 2010f2 32 bit. Here is the code snippet and the results:
    Rob
    Solved!
    Go to Solution.

    Robert Cole wrote:
    I think I prefer the ~ for negation since ^ is also used for beginning of the string. But we work with what we have.
    Let me offer you a tip and perhaps defend the honor of the regex a little bit.  One of my favorite features of regexes is the ability to specify character classes (and their negation).  One of the reasons I have to think about the ~ versus ^ is that I rarely use ^ in a regex alternative. 
    Some examples:
    [0-9] = \d (digit)
    [^0-9] = \D (not a digit)
    The equivalent regex for your case is: \D+ \d+

  • Match Regular Expression not returning submatches.

    I am having an issue with Match Regular Expression not returning the appropriate number of submatches.  My string is as follows:
    DATAM    995000    1.75    0.007    -67.47    24.493    99.072
    The spaces are tabs and the length is not fixed so simple string manipulation is out of the question.  The regular expression I was trying is as follows:
    (?<=\t)[0-9\.\-]*(?=(\t|$))
    It successfully returns Whole Match as the first number but no submatches are returned.  I've tried simpler expressions which work in Matlab and EditPad Pro such as [0-9.-]* but never got the same answer in Labview.
    What is going on?

    Here is an image of the VI.  The top portion is the input from our Licor 7000.  The bottom portion is the bit of code I'm having problems with.
    Attachments:
    matchregularexpression.jpg ‏336 KB

  • "Match Regular Expression" and "Match Pattern" vi's behave differently

    Hi,
    I have a simple string matching need and by experimenting found that the "Match Regular Expression" and "Match Pattern" vi's behave somewhat differently. I'd assume that the regular expression inputs on both would behave the same. A difference I've discovered is that the "|" character (the "vertical bar" character, commonly used as an "or" operator) is recognized as such in the Match Regular Expression vi, but not in the Match Pattern vi (where it is taken literally). Furthermore, I cannot find any documentation in Help (on-line or in LabVIEW) about the "|" character usage in regular expressions. Is this documented anywhere?
    For example, suppose I want to match any of the following 4 words: "The" or "quick" or "brown" or "fox". The regular expression "The|quick|brown|fox" (without the quotes) works for the Match Regular Expression vi but not the Match Pattern vi. Below is a picture of the block diagram and the front panel results:
    The Help says that the Match Regular Expression vi performs somewhat slower than the Match Pattern vi, so I started with the latter. But since it doesn't work for me, I'll use the former. But does anyone have any idea of the speed difference? I'd assume it is negligible in such a simple example.
    Thanks!
    Solved!
    Go to Solution.

    Yep-
    You hit a point that's frustrated me a time or two as well (and incidentally, caused some hair-pulling that I can ill afford)
    The hint is in the help file:
    for Match regular expression "The Match Regular Expression function gives you more options for matching
    strings but performs more slowly than the Match Pattern function....Use regular
    expressions in this function to refine searches....
    Characters to Find
    Regular Expression
    VOLTS
    VOLTS
    A plus sign or a minus sign
    [+-]
    A sequence of one or more digits
    [0-9]+
    Zero or more spaces
    \s* or * (that is, a space followed by an asterisk)
    One or more spaces, tabs, new lines, or carriage returns
    [\t \r \n \s]+
    One or more characters other than digits
    [^0-9]+
    The word Level only if it
    appears at the beginning of the string
    ^Level
    The word Volts only if it
    appears at the end of the string
    Volts$
    The longest string within parentheses
    The first string within parentheses but not containing any
    parentheses within it
    \([^()]*\)
    A left bracket
    A right bracket
    cat, cag, cot, cog, dat, dag, dot, and dag
    [cd][ao][tg]
    cat or dog
    cat|dog
    dog, cat
    dog, cat cat dog,cat
    cat cat dog, and so on
    ((cat )*dog)
    One or more of the letter a
    followed by a space and the same number of the letter a, that is, a a, aa aa, aaa aaa, and so
    on
    (a+) \1
    For Match Pattern "This function is similar to the Search and Replace
    Pattern VI. The Match Pattern function gives you fewer options for matching
    strings but performs more quickly than the Match Regular Expression
    function. For example, the Match Pattern function does not support the
    parenthesis or vertical bar (|) characters.
    Characters to Find
    Regular Expression
    VOLTS
    VOLTS
    All uppercase and lowercase versions of volts, that is, VOLTS, Volts, volts, and so on
    [Vv][Oo][Ll][Tt][Ss]
    A space, a plus sign, or a minus sign
    [+-]
    A sequence of one or more digits
    [0-9]+
    Zero or more spaces
    \s* or * (that is, a space followed by an asterisk)
    One or more spaces, tabs, new lines, or carriage returns
    [\t \r \n \s]+
    One or more characters other than digits
    [~0-9]+
    The word Level only if it begins
    at the offset position in the string
    ^Level
    The word Volts only if it
    appears at the end of the string
    Volts$
    The longest string within parentheses
    The longest string within parentheses but not containing any
    parentheses within it
    ([~()]*)
    A left bracket
    A right bracket
    cat, dog, cot, dot, cog, and so on.
    [cd][ao][tg]
    Frustrating- but still managable.
    Jeff

  • Question about match regular expression

    Colleagues,
    Very stupid question. I would like to get substring between "..." symbols. For example, string 02 July from Explosion occurred on "02 July", 2008.
    How to do this with single Match Regular Expression?
    For example such expression ".*" will give me "02 July":
    But I would like to get it without " symbols!
    I tried this "[~"]*" and this "[~"].*", then read this and this , and all without success... But I'm sure it should be possible. Can you help me?
    Andrey.
    PS
    This regular expression should give exactly the same output as following construction:

    I'm only using 7.0 now, but you can do this with Scan from String...
    %[^"]"%[^"]"%[^"]
    Message Edited by Phillip Brooks on 07-02-2008 02:47 PM
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    NotPCRE.png ‏20 KB

  • Multi-line String - Match Regular Expression

    I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
    Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?  
    Solved!
    Go to Solution.
    Attachments:
    MultiLine Regular Expression.vi ‏22 KB

    aaronb wrote:
    I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
    Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?  
    Match Regular Expression works well for this.
    Ben64

  • Match Regular Expression Function input string format

    Hi,
    I am new to labview and was having some difficulties using the Match Regular Experssion Function.  
    I am using labview to communicate with a sensor.  I have installed the NI device driver to do so.  The output of my sensor is in the format, 
    X20
    R40 P20 A123.  The numbers in this case are arbitrary.  I am trying to use Match Regular Expression Function to display and perform mathematical operations on the numbers.  I am having difficulties formatting the input string on the Match Regular Expression Function.  Could you please give me some tips on how to format the example I provided.  
    Thank

    MoAgha wrote:
    Hi,
    I am new to labview and was having some difficulties using the Match Regular Experssion Function.  
    I am using labview to communicate with a sensor.  I have installed the NI device driver to do so.  The output of my sensor is in the format, 
    X20
    R40 P20 A123.  The numbers in this case are arbitrary.  I am trying to use Match Regular Expression Function to display and perform mathematical operations on the numbers.  I am having difficulties formatting the input string on the Match Regular Expression Function.  Could you please give me some tips on how to format the example I provided.  
    Thank
    Here is a way to do it if the format is constant (X R P A followed by a positive integer number).
    Ben64

  • Parse Mac Address with match regular expression

    Hi Everyone,
    I have a problem with the Match Regular Expression function,
    I am trying to parse the response two a arp -a 192.168.0.15 request in order to extract MAC address of this remote IP, I used the following RegEx: ^([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2})$
    I am wondering why do I need to do a string subset first to extract only the MAC Address part. Isn't Match Regular Expression function capable of recognizing the RegEx directly in the middle of a string?
    I only works when I extract the right tring subset as in the picture bellow.
    Thanks for your answers.
    Solved!
    Go to Solution.
    Attachments:
    Mac Address.JPG ‏40 KB

    Get rid of the "^" in the beginning of your regular expression. You are instructing it to find the pattern at the beginning of the string.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Pattern matching regular expressions

    I'm attempting to determine if a string matches a pattern of containing less than 100 alphanumeric characters a-z or 0-9 case insensitive. So my regular expression string looks like:
    "^[a-zA-Z0-9]{0,100}$"And I use something like...
    Pattern pattern = Pattern.compile( regexString );I'd like to modify my regex string to include the email 'at' symbol "@". So that the at symbol will be allowed. But my understanding of regex is very limited. How do I include an "or at symbol" in my regex expression?
    Thanks for your help.

    * Code by sabre150
    private static final Pattern emailMatcher;
        static
            // Build up the regular expression according to RFC821
            // http://www.ietf.org/rfc/rfc0821.txt
            // <x> ::= any one of the 128 ASCII characters (no exceptions)
            String x_ = "\u0000-\u007f";
            // <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
            //              | "," | ";" | ":" | "@"  """ | the control
            //              characters (ASCII codes 0 through 31 inclusive and
            //              127)
            String special_ = "<>()\\[\\]\\\\\\.,;:@\"\u0000-\u001f\u007f";
            // <c> ::= any one of the 128 ASCII characters, but not any
            //             <special> or <SP>
            String c_ = "[" + x_ + "&&" + "[^" + special_ + "]&&[^ ]]";
            // <char> ::= <c> | "\" <x>
            String char_ = "(?:" + c_ + "|\\\\[" + x_ + "])";
            // <string> ::= <char> | <char> <string>
            String string_ = char_ + "+";
            // <dot-string> ::= <string> | <string> "." <dot-string>
            String dot_string_ = string_ + "(?:\\." + string_ + ")*";
            // <q> ::= any one of the 128 ASCII characters except <CR>,
            //               <LF>, quote ("), or backslash (\)
            String q_ = "["+x_+"$$[^\r\n\"\\\\]]";
            // <qtext> ::=  "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
            String qtext_ = "(?:\\\\[" + x_ + "]|" + q_ + ")+";
            // <quoted-string> ::=  """ <qtext> """
            String quoted_string_ = "\"" + qtext_ + "\"";
            // <local-part> ::= <dot-string> | <quoted-string>
            String local_part_ = "(?:(?:" + dot_string_ + ")|(?:" + quoted_string_ + "))";
            // <a> ::= any one of the 52 alphabetic characters A through Z
            //              in upper case and a through z in lower case
            String a_ = "[a-zA-Z]";
            // <d> ::= any one of the ten digits 0 through 9
            String d_ = "[0-9]";
            // <let-dig> ::= <a> | <d>
            String let_dig_ = "[" + a_ + d_ + "]";
            // <let-dig-hyp> ::= <a> | <d> | "-"
            String let_dig_hyp_ = "[-" + a_ + d_ + "]";
            // <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
            // String ldh_str_ = let_dig_hyp_ + "+";
            // RFC821 looks wrong since the production "<name> ::= <a> <ldh-str> <let-dig>"
            // forces a name to have at least 3 characters and country codes such as
            // uk,ca etc would be illegal! I shall change this to make the
            // second term of <name> optional by make a zero length ldh-str allowable.
            String ldh_str_ = let_dig_hyp_ + "*";
            // <name> ::= <a> <ldh-str> <let-dig>
            String name_ = "(?:" + a_ + ldh_str_ + let_dig_ + ")";
            // <number> ::= <d> | <d> <number>
            String number_ = d_ + "+";
            // <snum> ::= one, two, or three digits representing a decimal
            //              integer value in the range 0 through 255
            String snum_ = "(?:[01]?[0-9]{2}|2[0-4][0-9]|25[0-5])";
            // <dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
            String dotnum_ = snum_ + "(?:\\." + snum_ + "){3}"; // + Dotted quad
            // <element> ::= <name> | "#" <number> | "[" <dotnum> "]"
            String element_ = "(?:" + name_ + "|#" + number_ + "|\\[" + dotnum_ + "\\])";
            // <domain> ::=  <element> | <element> "." <domain>
            String domain_ = element_ + "(?:\\." + element_ + ")*";
            // <mailbox> ::= <local-part> "@" <domain>
            String mailbox_ = local_part_ + "@" + domain_;
            emailMatcher = Pattern.compile(mailbox_);
            System.out.println("Email address regex = " + emailMatcher);
        }Wow. Sheesh, sabre150 that's pretty impressive. I like it for two reasons. First it avoids some false negatives that I would have gotten using the regex I mentioned. Like, [email protected] is a valid email address which my regex pattern has rejected and yours accepts. It's unusual but it's valid. And second I like the way you have compartmentalized each rule so that changes, if any custom changes are desired, are easier to make. Like if I want to specifically aim for a particular domain for whatever reason. And you've commented it so that it is easier to read, for someone like myself who knows almost nothing about regex.
    Thanks, Good stuff!

  • Match Regular Expression Function

    Hi guys, using this pattern I got this error:
    -4600 Error occurred during regular expression match.
    I have attached the VI.
    can you help me?thank you
    Solved!
    Go to Solution.
    Attachments:
    Untitled 2.vi ‏30 KB

    inuyasha84 wrote:
    hi well i want to save (create) a file and do a check to see if the new file that I want to create already exist or not. so the idea was to see if the path of the new file is equal to the old path
    Why not just use "Check if file or folder exists"? (File I/O -> Adv File Funcs)
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • IR filter using "matches regular expression"

    Hi,
    I am familiar with Perl regular expressions, but I'm having trouble using the IR filter by regular expression in Apex.
    For instance, I would like to search for dates of format 'MM/DD/YY' - can someone tell me how this would be done? I tried '[0-9](2)/[0-9](2)/[0-9](2)' and many other patterns to no avail.
    Also can you point me to a good thread for regular expressions in Apex?
    Thanks for any help.

    Hi,
    you can play around with oracle regular expressions at
    http://www.yocoya.com/apex/f?p=YOCOYA:REGEXP_HOME:0:
    It's an Apex application, albeit "seasoned", where you can build and test the regex and it will be 100% compatible as it runs natively, so it's not simulated on a different platform.
    Most likely the IR filter will make use of REGEXP_LIKE so you can pick that function from the menu.
    Flavio
    http://oraclequirks.blogspot.com
    http://www.yocoya.com

  • Not understanding the String matches (regular Expression)

    Everytime I search I do not find any examples of java String's matches function.
    I am reading an input file and just want to print if it matches the pattern
    /thisdirectory/source_code/*.cc
    I even tried to test by doing
    if( line.matches("[a-z]") ){
    System.out.println("IT MATCHES");
    Which should just test if there is any letter a to z, which there is in the file but it never comes back as true that it fines a to z in the line.

    I totally understand what you are going through, maybe someone could shed some light on my problem as well.
    In my code the getText() method is pulling the text from a form being filled out. I am checking for validation of fields: But the problem is that my code wont compile with matches method inside these lines of code.:
    else if ( !firstTextField.getText().matches( "[A-Z][a-zA-Z]*" ) )
              JOptionPane.showMessageDialog(this, "Invalid First Name");
              else if(!lastTextField.getText().matches("[A-Z][a-zA-Z]*" ) )
                        JOptionPane.showMessageDialog(this, "Invalid Last Name");
              else if(!addressTextField.getText().matches("\\d+\\s+([a-zA-Z]+\\s[a-zA-Z]+") )
                        JOptionPane.showMessageDialog(this, "Invalid Address");
              else if(!cityTextField.getText().matches("[a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+") )
                        JOptionPane.showMessageDialog(this, "Invalid City");
              else if(!stateTextField.getText().matches("[a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+") )
                        JOptionPane.showMessageDialog(this, "Invalid State");
              else if(!zipTextField.getText().matches("\\d{5}") )
                        JOptionPane.showMessageDialog(this, "Invalid ZipCode");
              else if(!phoneTextField.getText().matches("[1-9\\d{2}-[1-9]\\d{2}-\\d{4}") )
                        JOptionPane.showMessageDialog(this, "Invalid Phone number. Please enter phone number in format 1-111-111-1111");
    The error I am receiving is:
    The method matches(String) is undefined for the type String.
    What gives?

  • Problems with pattern matching Regular expression

    String emailRegEx = "(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*";
    String test = "[email protected]";
    if(test.matches(emailRegEx)) {
    }throws an exception
    java.util.regex.PatternSyntaxException: Illegal repetition near index 5.

    It works fine for me.

  • Match Regular Expression won't work with Null

    Is that right? I don't see it in the documentation. I can use it on \01 , just not \00.
    Is there a way around this problem? I know that Match Pattern works, but I want to use it with separate partial matches (a|b) which Match Pattern does not support.

    Here's a possibility:
    If you try to set the constant "\00" to "\0" with the '\' Code Display on, it just converts it back to "\00" on the display.
    The function uses the PCRE library.  From the library documentation (the pcrepattern man page):
    "After \0 up to two further octal digits are read. In both cases, if there
    are fewer than two digits, just those that are present are used. Thus the
    sequence \0\x\07 specifies two binary zeros followed by a BEL character
    (code value 7). Make sure you supply two digits after the initial zero if the
    pattern character that follows is itself an octal digit."
    So, what if, behind the scenes, LV is actually feeding the match function just a "\0"?  I'm guessing (but haven't been able to verify) it would match *any* input string, immediately, with an offset of zero.  Testing with random search strings shows behavior that might indicate this.
    If the above is true, getting around it might be hard, since you're at the mercy of LV as to exactly how it calls that library.
    Fun stuff... okay, back to work with me.  Good luck,
    Joe Z.

  • Match regular expression or pattern

    I am having big trouble with extracting measurement results from a string from serial port.
    I get a report through serial connectio from some device. It looks like that:
    Plane 1 Angle 1 Plane 2 Angle 2 In
    RotorID rpm [g·mm] [°] [g·mm] [°] Tol
    1964.7 0.145999 201.6 0.151779 346.5 Y
    2014.5 0.156608 197.6 0.139722 340.9 Y
    ealon ok 2012.1 0.143454 199.8 0.150243 344.6 Y
    ealon nok 2023.3 0.430547 217.7 0.833347 313.3 Y
    DN-3259824_001 2135.9 0.305822 246.2 0.296502 305.2 Y
    DN-3259824_002 2051.4 0.324227 241.1 0.327651 299.0 Y
    DN-3259824_020 2045.9 0.139268 150.2 0.281890 21.6 Y
     I cannot separate data with spaces, because sometimes there is no "RotorID" so all data shifts to the left.
    There are always 7 columns. Sometimes RotorID is empty sometimes it consists some chars and some numbers. I never know its length. Other data is always present and separated with space. 
    Can you help me please.
    Solved!
    Go to Solution.

    First use "Scan String For Tokens" then pull the float out of that.
    This is from my library that I use to do exactly that. 
    Omar
    Attachments:
    ALL Delimited Fract String per Line To [[DBL]].vi ‏17 KB

Maybe you are looking for