LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

distinction between regular expression and format string

Sometimes, I am very complex between Scan from string(format string) and Match pattern(regular expression).
Do you know when Match pattern is useful comparing to Scan from string or vice versa?
 
For example,  how to extract the RANDOM code "BHEHBHEGDIAGJIIGEIGJBCFAHCBCHICC without \n" from the unquotated string using two functions?
More general solution is prefered for the knowledge.
 
"Warning: All data are protected by the security code (DO NOT EDIT).\n
Security code: BHEHBHEGDIAGJIIGEIGJBCFAHCBCHICC\n"
 
How about if BadidfkddidC, format of RANDOM lower and capital characters?

 

메시지가 10-19-2007 09:59 PM에 labmaster에 의해 편집되었음

0 Kudos
Message 1 of 3
(2,794 Views)
It seems like Match Pattern and Match Regular Expression performed the same.  Try the attached VI (LV8.2.1).  I set it up to look for Security Code: and return everything after.  Then trim white space to get rid of spaces and the \n character.

Message Edited by Ravens Fan on 10-19-2007 11:17 PM

Download All
0 Kudos
Message 2 of 3
(2,785 Views)
Just a bit of trivia - Match Regular Expression appears to match a more complete set of "regular expressions" than Match Pattern does.
 
To see a difference in the example above, change the "regular expression" input from "Security code:" to "Security CAD|Security code:"
("Security CAD" OR "Security code:")
 
I don't know if there's a way to specify a match of all upper/lower case-permutations of a particular string.  When I want to ignore case I usually do the obvious - before Match, coerce the inputs to the same case! Smiley Happy
 
Cheers!

Message Edited by tbd on 10-20-2007 01:43 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 3 of 3
(2,765 Views)