longzoo Posted June 5, 2014 Report Share Posted June 5, 2014 Hello all, I am having an interesting problem that i finally traced down to the simple little "match pattern" vi. I inherited many programs that use that vi for everything from pulling a single character out to sorting a huge list from a text file (neither of which i advocate). HOWEVER, I was troubleshooting some code that only showed an error in one specific situation and upon delving in I found this vi to be misbehaving, or more likely I misunderstand how it is behaving ;-) The vi has to remove an echo command then display the response. it goes like this i send 0xABCD and read back 0xABCD1234, i need to display 0x1234. I did a workaround where i read the number of bytes sent then use that as an offset for "string subset" vi. but i am curious why "match pattern" is not working for this one hex command . Please see the attached vi. that will show two hex commands, one that works and one that does not. You will notice both sent commands have 14 bytes and match the first 14 bytes of the reply, both show a match if you pull the first 14 bytes of the reply but only one matches with match pattern...it is written with LV 2011 SP1. Thanks for looking. Dave MatchProblems.vi Quote Link to comment
Mellroth Posted June 5, 2014 Report Share Posted June 5, 2014 You will have to escape special characters like '', for the match pattern to work. In the TRUE case it is present,and unintentionally escapes the next character in the search string. /J Quote Link to comment
longzoo Posted June 5, 2014 Author Report Share Posted June 5, 2014 Thanks Mellroth! That was it....i did a "search and replace" for 0x5C with null on both strings and it is working now...although i see a new folly in the way we do this, there are many characters we will inadvertently hit since our string is any combination of hex characters 0x3F (?) 0x2E (.) etc. Thanks for the info Dave Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.