06-05-2013 03:47 AM - edited 06-05-2013 03:49 AM
Today I was debugging one of my parsing scripts and found that "match pattern" subvi doesn't handle properly ASCII symbol 91 which is "[" but does work with ASCII symbol 93 "]".
Dear NI representatives, could you report that bag to your developers please?
And please don't try to persuade me that it is "by design"
Labview version 2012
06-05-2013 04:02 AM
It's by design
The brackets are special characters that are there to indicate ranges. If you want to search for the bracket you need the escape character first. Try "\[".
06-05-2013 09:27 AM
@Abdulaev_Rustam wrote:
Today I was debugging one of my parsing scripts and found that "match pattern" subvi doesn't handle properly ASCII symbol 91 which is "[" but does work with ASCII symbol 93 "]".
Dear NI representatives, could you report that bag to your developers please?
And please don't try to persuade me that it is "by design"
Labview version 2012
I guess M_Peeker is trying to persuade you that it was "by design." 😉
06-05-2013 10:29 AM
This is not a bug, it is expected behavior. Look at the following link (first and second table rowa) and you will see that only for the opening bracket you need the escape character. For the closing bracket Match Pattern will do the litteral match.
Ben64
http://www.regular-expressions.info/reference.html
Did it persuade you that it is "by design"
04-20-2014 09:10 AM
Hai I have the same problem here. Did you find a soulution. I am not able to search "[" in the match regular expression. It returns a empty string. If you have a solution it would be nice if you could write me a mail or post in the forum.
Regards
04-20-2014 09:12 AM
The solution is here. Seriously, did you stop to read the post above yours?
04-20-2014 09:15 AM
The answer is already provided above.
To scan for the literal "[", you must escape it by adding a backslash in front like this: "\["
The [ without an escape indicates a range to be searched, such as [0-9] would look for digits zero through nine.
04-20-2014 09:21 AM
Thanks. I did try all those before some how there was a mistake. Now it works. Thank you.
With regards
04-20-2014 10:48 AM
Hai here is another problem in the Match pattern. How come when I put the same in a array and try to match the string through match pattern but gives a false result.
I would like to in this case for example if the string in the input array and the string in the regular expression match then a string should be added "001]" to it. In the vi which I am posting. It does not recognize when it is with the left brackt. When without bracket it does.
here in this case the string in the input array "[Step" should be seen as "[Step001]" in the output array. Can any one give a solution.
04-20-2014 11:46 AM
Your VI doesn't have any data in any of the controls. You need to put data in the controls, save them as default, then save and attach the VI to your post.
Without data to work on, there is no way we can troubleshoot your problem.