08-04-2015 04:09 AM
I'm wondering about an inconsistency between
"search and replace regular pattern.vi" and
"search regular expression.vi"
found in string functions palette.
Here is my data:
input : ein test "text"
search: (["*$])(\w+)\1
replace: foo
In the second vi, last parameter is not available but thats not important, here.
Now my question:
"search regular expression.vi" finds "text" and sets the output before match to "ein test" as well as the output
after match to nothing. This is also the expected result.
Instead "search and replace regular pattern.vi" finds no match (returns -1 on offset after match) and therefore also
returns the whole input string as the result string.
This is mentioned inconsistency, because the regex should of course be valid for both string palette vi's.
Is there a workaround or did i understand something wrong?
Thank you!
08-04-2015 04:39 AM
Labuser16383, check this thread http://forums.ni.com/t5/LabVIEW/quot-Match-Regular-Expression-quot-and-quot-Match-Pattern-quot/td-p/... .
Briefly - Search and replace regular pattern.vi has limited set of regular expressions, which it can use. That's why these two VIs behave in different way.
08-04-2015 05:16 AM
Ok, i understand. Thank you.
Now the question is, what function should be used instead?
"Search and replace string.vi" with regex enabled?
08-04-2015 07:15 AM
It's difficult for me to give an answer on it - b/c I didn't use Search and replace string.VI with regex enabled - but, you can just try, and see, whether it works...
08-04-2015 08:57 AM
Search works. Replace works only, if no backreferences are beeing used (eg $1, $2 ...).
Are there some others who know this kind of problems?