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

Similar Messages

  • Return which pattern was matched in a regular expression

    Given the following code;
    Pattern pattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}" + "|" + "\\btest\\b");
    Matcher matcher = pattern.matcher("255.255.255.255");
    while (matcher.find()) {
         System.out.println(matcher.group());
    }This prints out 255.255.255.255.
    Can anyone tell me how I obtain the actual pattern ("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}") that was used to find the result?
    I only want to loop through my search context once, so I am concatenating a number of expressions into one large regex. However, for each result I need to know which portion of the large regex triggered the match.
    Any help would be appreciated.

    You can keep the regexes separate without having to do many passes by using some lesser-known features of the Java regex package. Check this out: import java.util.regex.*;
    public class Scannit
      static Pattern pWord    = Pattern.compile("\\w+");
      static Pattern pComment = Pattern.compile("/\\*(?:[^*]++|\\*(?!/))*+\\*/");
      static Pattern pString  = Pattern.compile("\"(?:[^\"\\\\]++|\\\\.)*+\"");
      static Pattern pWS      = Pattern.compile("\\s+");
      static Pattern sample  = Pattern.compile("(?s).{1,12}");
      static String str = "bork \"bork\" /*bork \"bork\" bork*/ bork";
      public static void main(String... args)
        int start = 0;
        int end = str.length();
        Matcher m = pWS.matcher(str);
        while ( start < end )
          m.region(start, end);
          if ( m.usePattern(pWord).lookingAt() )
            System.out.printf("%3d word: %s%n", start, m.group());
          else if ( m.usePattern(pString).lookingAt() )
            System.out.printf("%3d string: %s%n", start, m.group());
          else if ( m.usePattern(pComment).lookingAt() )
            System.out.printf("%3d comment: %s%n", start, m.group());
          else if ( m.usePattern(pWS).lookingAt() )
            System.out.printf("%3d whitespace%n", start);
          else
            m.usePattern(sample).lookingAt();
            System.out.printf("Bad data: '%s'%n", m.group());
            System.exit(1);
          start = m.end();
    }{code} Instead of using find() and letting the Matcher scan ahead for a match, you control where the match attempts start by using the region() and lookingAt() methods.  Cycling through the regexes with the usePattern() method is very quick because the Matcher and the Patterns are all pre-instantiated.  Just make sure the regexes are reasonably efficient and this should be plenty fast enough--at least, I've found it so.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Non-greedy regular expression search/replace

    i want to be able to do non-greedy regular expressions as
    dreamweaver defaults to greedy and eats all of the match it can
    match.
    Is there an add-on to add a checkbox or soemthing in the
    Search and Replace Dialog for non-greedyness?
    i guess i could throw something in there to match some simple
    expressions like...
    text to search n' replace:
    $Query .= ", dateReceived='".addslashes($dateReceived)."'" .
    ", dateReleased='".addslashes($dateReleased)."'";
    Instead of using this now
    Find: '"\.addslashes\(\$([^\)]*)\)\."'
    Replace: ". dateInsert($$1) ."
    i want to just use this wihout it getting greedy with the .*
    Find: '"\.addslashes\(\$(.*)\)\."'
    Replace: ". dateInsert($$1) ."

    In regular expression, if you want the .* to not be greedy
    you add a '?' after so yo you have '.*?'
    Find: '".addslashes($dateReleased)."'
    Hope that help,
    Chris
    Adobe Dreamweaver Engineering

  • Matching Quotes With Regular Expressions

    Hi, I have been attempting to develop an app which extract texts from pdfs then applies regular expression to the text. In one instance I attempt to match a curly open quote symbol which matches the . construct as well as the \W. However, it does not match \p{Punct} or \p{P} - does anyone know why this might be?
    I have read that a pattern \p{Pi} exists for matching opening brackets but am told when I run Java that no such characters class exists - is there anywhere where I can get info on all of the character classes available (not the Pattern javadoc)?
    Thanks very much,
    Ross

    . construct match anything and \W matches any non alphanumaric
    to match a curly bracket use \{
    Basicaly ( { [  has special meanings in regex so when you match them you have to use \{, \(,  \[  in java strings it means \\{, \\(, \\[                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Regular Expression Search in Forms Builder

    Hi everyone, can anyone help me out?
    I'm working on a legacy forms migration project (3 to 10g) where item references often do not include the block name.
    eg.
    :stock_level := :default_level;
    instead of
    :stk.stock_level := :ctrl.default_level;
    There are also instances of set_item_property('stock_level',....)
    In complex multi-block forms this obviously makes the form difficult to understand.
    Is there a way in which I can search the triggers and program units of a form for items that don't have a block prefix? The Forms search and replace function has a Regular Expression feature, but I have no experience in this area.
    I assume I'm looking for something like this:- ":", followed by a character string that doesn't contain a "." or "="
    Thanks

    You might have a look at the commercial product formsAPIMaster, it has the ability to do such searches (and also automatic replacements, if needed)

  • Regular Expression Search for Case Statement in VBA

    Hi,
    I'm having trouble trying to use regular expressions in a case statement. I have a CSV spreadsheet of a server's netstat output and am trying to plot everything into Visio. I have been able to do that, however I'm not trying to expand this capability and
    resuse the same code for many different servers. 
    I have the mainServer variable set as a Variant and in my current example it is set as "INTPXY001" (internal proxy server 001). I have tried different regex statements for the potential to have INTPXY001 - INTPXY999, EXTPXY001 - EXTPXY999, and
    SVCPXY001 - SVCPXY999 in place of the Case "INTPXY001", but nothing I have tried seems to work.
    '========================================
    Set mainServer As Variant
    Set AppVisio = CreateObject("visio.application")
    AppVisio.Visible = True
    AppVisio.Documents.AddEx "", visMSDefault, 0
    AppVisio.Documents.OpenEx "server_u.vss", visOpenRO + visOpenDocked
    mainServer = ActiveSheet.Cells(1, 2) 'sets mainServer to INTPXY001
    With AppVisio.ActiveWindow.Page
    Select Case mainServer
    Case "INTPXY001"
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.ItemU("Proxy server"), 2.25, 9.25
    Case Else
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.Item(("Server"), 2.25, 9.25
    End Select
    End With
    '========================================

    You cannot declare variables As Variant in VBScript. All variables in VBScript are implicitly variants.
    If you are asking about VBA (Visual Basic for Applications), then you're not asking in the correct forum.
    -- Bill Stewart [Bill_Stewart]

  • Analog output to the DAQ that changes when controls on the front panel change

    I'm using the PCI-6024E, and trying to output an analog waveform that can change when one of the two controls on the front panel change. It outputs fine setting it to continuous output and using a simple while loop around the "Is Task Done" VI, but if I put the "Write" VI in the while loop, it doesn't output steadily. I then tried to use an event structure, so that I'd only have to write every time something on the front panel changes, but for some reason it was writing finite samples, even though I set the Timing VI to continuous. I looked around the NI site, and found an article about this with an example. I tried to change it around to use my waveform, but whenever I run it, I get a memory underflow error. Has anyone needed to do this before? Thanks in advance.
    -- Josh Matloff

    Hi Josh-
    It looks like you forgot to post the code still, but I'll take a stab at the problem anyway. It sounds like you're looking for a way to update a continuous waveform at runtime.
    You will need to stop the task in order to replace the write buffer information, but this will only be a small gap in operation. I have attached a modified LabVIEW shipping example that shows how to use value change events for any of the pertinent waveform parameters to either programmatically stop the task, replace the buffer, set timing and restart or to just pass the task information straight through. This will lead to continuous operation with no breaks at the output.
    Please let us know if this clears up your questions.
    Thanks-
    Tom W
    National Instruments
    Attachments:
    Cont Gen Voltage Wfm-Int Clk with Runtime Update.vi ‏134 KB

  • Patterns and Regular Expressions

    HI
    I am trying to search a string for words and return the count
    word : are
    String: are , we care about this.
    i get back count 2. It counts are and also care.
    but the count should be one.
    How can i limit the matcher to find only 'are' do a exact word match.
    this is the piece of code i am using.
    word = word + "\\b";
    Pattern p = Pattern.compile(word,Pattern.CASE_INSENSITIVE);
    //create a matcher with input string
    Matcher m = p.matcher(strOfFile);
    boolean result = m.find();
    while (result){
    intCount++;
    result = m.find();
    return intCount;
    Thanks

    Really doesn't work! Can't explain behavior since \A and \z are valid as anchors. I will check expression against Perl.
    word = "\\b" + word + "\\b"; // it works.

  • Pattern and Regular Expression problem

    Hi all!
    I have trouble with constructing a pattern.
    Consider the following:
    import java.util.regex.*;
    public class Parser {
    public Parser() {
    String pattern = "<i18n:message(.*)/>";
    String myline = "<INPUT type=\"button\" name=\"cancel\" value='<i18n:message key=\"EXP.EP.EPDATES.CANCEL\"/>' class=\"normal08\" onClick=\"javascript:disableInput();document.panel_menu.submit();\"/>";
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(myline);
    while ( (m.find()) ) {
    System.out.println(m.group());
    public static void main(String[] args) {
    new Parser();
    How should I construct the pattern in order to extract from the string myline just the following sequence: <i18n:message key=\"EXP.EP.EPDATES.CANCEL\"/>
    It seems that using the pattern I wrote, it continues the match until the last appearance of "/>", and I need to have the match done until the first appearance of "/>".
    Thanks a lot.

    No, modify it to (.*?).Hey, unky. Would you mind schooling me a bit here?
    "<i18n:message(.*?)/>" right?
    against "<i18n:message key=\"EXP.EP.EPDATES.CANCEL\"/>' class=\"normal08\" onClick=\"javascript:disableInput();document.panel_menu.submit();\"/>"
    I think I understand, but would appreciate confirmation or correction.
    .* is zero or more of anything. The ? makes it reluctant (also called lazy?).
    So .* is compared against nothing, succeeds, and the regex moves on to the next character.
    This doesn't match / so regex backtracks and tries to match .* against the space, which succeeds, but then / doesn't match against the k in key
    So we backtrack, and reluctantly add the k to what .* matches.
    We keep adding a character to .*'s match every time the next character isn't a /.
    Eventually, .* matches everything up to and including the quote before the first />.
    At this point, the / and > literals match, and we're done.
    Yes?
    And we needed to make it reluctant, else the .* would have started by matching as much of the string as it could, gobbling up all of it, and then backtracking to give the /> literals their match at the end of the string.
    Yes?
    Thanks!

  • Feedback / Submit an idea don't Work (Page not found) || Multiline Regular Expression Search

    Hello,
    I reached for some months an idea with a (multiline edeting, regexp search).
    Nice to see this has already been integrated, making me but disappointing is the regex search, in combination with the Multiline Edeting.
    But what it brings me to use the regexp search, when I cant edit all hits.
    In this feature, I would like to point again.
    But unfortunately I cant find the feedback system, and here in the forum I always get the error message, page not found.
    Beautiful would be if both would be patched;)
    For me, the code is currently the "http://www.sublimetext.com/" editor of my choice if Adobe would therefore produce some its functions, edge code would be a real alternative.
    Yet I find Edge Code is not ready for Daily-use.
    Greetings
    Dirk Persky

    Hi Dirk,
    Thanks for reporting the broken links -- we'll look into that.  As Randy said, you're welcome to just post suggestions & issues here in the forum, though.
    Regarding multiline regexp search: that is possible in Edge Code, with some limitations:
    To search multiple files, use the Find in Files command, and then use any regexp containing "\n" -- it will match the newlines correctly.
    To search a single file, right-click the file and chose "Find In..." (it will behave like Find in Files, but limited to that one file)
    Caveat: you can't use the multiline $/^ anchors in your regexp
    Caveat: there's no workaround for using the Replace command with multiline regexps
    The latest Brackets release 0.41 fixes both the caveats listed above -- though you'll still have to use the "Find In..." workaround (or "Replace In..." for Replace).  We eventually plan to further improve this -- you can watch the full multiline search/replace item on our feature backlog for updates.
    Hope that helps,
    - Peter

  • What  is regular expression search function

    hi
    what is use CHARTOROWID ,COMPOSE fuction in oracle

    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions025.htm#SQLRF00615
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions032.htm#SQLRF00618

  • Java Regular Expressions and Pattern

    I have a file that i first want to get all the lines that match a given pattern. Then from these lines that match i want to extract two values.
    Example line for the pattern to match
    INFO | jvm 1 | 2006/11/07 15:14:09 | INFO | Tue Nov 07 15:14:09 CET 2006 | XLDB PPS Data Dumper: MESSAGE:- 406 Processing .. '[ /opt/nexus/horizon/raw_data/network/pp_CE01S4H_sta_20050703T015717_SYDP3001_546.bdf ]'
    So all the lines that are like these i want to extract two variables
    2006/11/07 15:14:09
    and
    /opt/nexus/horizon/raw_data/network/pp_CE01S4H_sta_20050703T015717_SYDP3001_546.bdf
    so i can store these variables in a database.
    Can someone help me with writing the pattern to match and the regular express to extract? Also if anyone else has a better way of doing this i am all ears and i have a lot of log files to go through.

    import java.util.regex.*;
    class Main
      public static void main(String[] args)
        String txt="INFO | jvm 1 | 2006/11/07 15:14:09 | INFO | Tue Nov 07 15:14:09 CET 2006 | XLDB PPS Data Dumper: MESSAGE:- 406 Processing .. '[ /opt/nexus/horizon/raw_data/network/pp_CE01S4H_sta_20050703T015717_SYDP3001_546.bdf ]'";
        String re1=".*?";     // Non-greedy match on filler
        String re2="((?:2|1)\\d{3}(?:-|\\/)(?:(?:0[1-9])|(?:1[0-2]))(?:-|\\/)(?:(?:0[1-9])|(?:[1-2][0-9])|(?:3[0-1]))(?:T|\\s)(?:(?:[0-1][0-9])|(?:2[0-3])):(?:[0-5][0-9]):(?:[0-5][0-9]))";     // Time Stamp 1
        String re3=".*?";     // Non-greedy match on filler
        String re4="((?:\\/[\\w\\.]+)+)";     // Unix Path 1
        Pattern p = Pattern.compile(re1+re2+re3+re4,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
        Matcher m = p.matcher(txt);
        if (m.find())
            String timestamp1=m.group(1);
            String unixpath1=m.group(2);
            System.out.print("("+timestamp1.toString()+")"+"("+unixpath1.toString()+")"+"\n");
    }

  • Indexing on regular expression seach for dynamic pattern

    Hello All,
    Would it be possible to create any index for regular expression search (REGEXP_LIKE) for 'dynamic' pattern?
    If the pattern is static, then we can create FBI, but is there any way for dynamic patterns? Please advise.
    Regards,
    Hari

    Thanks Dom, I have never used Oracle Text. Would it be possible to provide some sample code for above requirement.
    Regards,
    Hari

  • Uri regular expression matching

    Hi, for some reason I cannot get a uri to match the following regular expression check.
    <If $uri !~ '^/dir/\?somename=(.*)'>
    NameTrans fn="restart" uri="/shownomatch?uriwas=$uri"
    </If>
    <Else>
    NameTrans fn="restart" uri="/showamatch?value=$1"
    </Else>I can see in the page that is restarted to that it should match by printing out the uriwas parameter.
    An example uri that should match but doesn't is /dir/?somename=5f801297-a8f6-42a4-933d-660f2120cd0d
    Any thoughts? I've tried a few different valid regular expressions, but cannot get a match.

    Thank you all for the help.
    My main goal was to provide verification that a user has logged in and has the proper authority to access a directory/resource. What I believe I now have is a check to verify that the user has a required cookie and that the value in the cookie matches the parameter in $query.
    Below is what I now have in the server's obj.conf file. Let me know if you think there is something that I am missing.
    <If $uri =~ '^/ValidationApp/*'>
      <Client security="false">
        NameTrans fn="redirect" url-prefix="https://server.domain.edu"
      </Client>
    </If>
    <If $uri !~ '^/ValidationApp/*'>
      <Client security="true">
        NameTrans fn="redirect" url-prefix="http://server.domain.edu"
      </Client>
    </If>
    <If $uri =~ "/SomeDir/*">
      <If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"}>
        NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/SomeDir'))"
      </If>
    </If>
    <If $uri =~ "/AnotherDir/*">
      <If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"}>
        NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/AnotherDir'))"
      </If>
    </If>The servlet used in the restart checks to see if the required cookie exists (ReqInfo) and if the uuid value (uid) is set in the session. If so it forwards to the uri (loc). If not it forwards to a login form the checks the user ID/password. It adds the uid to the session, creates the cookie, and forwards back to the requested uri.
    The Client security checks are down to make sure the user uses HTTPS when entering their user ID/Password.

  • REGULAR EXPRESSION FIND PLEASE  ;(

    HI FORM
    I have the following documents with the content
    doc1 = "ELECTRONICS DIGITAL CAMERA"
    doc2 = "ELECTRONICS DIGITAL CAMERA ACCESSIORIES"
    doc3 = "ELECTRONICS DIGITAL CAMERA OPTICS "
    Using regexpression I would like to get only 2nd document ONLY which has the content
    "ELECTRONICS DIGITAL CAMERA ACCESSIORIES"
    How to Achieve this
    Karthik

    You can try this one: ((digital|camera|accessories)[\\s]*)+
    Explainations:
    (digital|camera|accessories) - this group matches any of the 3 words
    [\\s] matches a space character [\\s]* matches any number of spaces
    ((digital|camera|accessories)[\\s]*) - this group matches any of the 3 words, optionnally followed by spaces
    ((digital|camera|accessories)[\\s]*)+ - matches any sequence of 3 words, seperated by spaces
    NOTES:
    - this regular expression matches "digitalcameraaccessories" because the * operator accepts 0 occurences.
    If you want to avoid this situation, change the * to a+, but you will have to append a space to the searched string
    in order to make the pattern match.
    - this regular expression will also match "digital digital camera" because there is no unicity checking.
    Hope this helped,
    Regards.

Maybe you are looking for