05-20-2025 01:14 PM - edited 05-20-2025 01:21 PM
Using LabVIEW 2023, I am trying to allow only alpha numeric strings, and dashes with the Search and Replace String function. The regular expression is a simple one as far as they go, but I'm at a loss as to why this doesn't filter the parenthesis, braces and brackets, i.e. ( ) { } and [ ]. I even tried removing the trailing dash just in case it was confusing it as the start of another series, and the result is the same. I set the font used in the block diagram to Consolas so you could see that the zero is NOT a capital letter O. I have also tried the Match Pattern function and got the same result. I have even entered the expression into one of the online RegEx testers sites and it spots exactly the characters I want to filter.
Here is the regex expression:
[^a-zA-Z0-9-]
Solved! Go to Solution.
05-20-2025 01:25 PM
you need to set the replace all flag to TRUE:
05-20-2025 01:50 PM
😖 That's embarrassing! Thanks! Any idea how to modify the regular expression to omit multiple consecutive dashes and remove any ending dashes?
05-20-2025 02:33 PM
05-20-2025 02:47 PM
I always forget to set that to true. My feeling is it should default to true.
You might have to do multiple search and replaces. First replacing consecutive dashes with a single dash, then removing end dashes, then using your original search and replace. But AI like chatgpt or grok are pretty good at doing this stuff. just make sure you tell it you are using LabVIEW's search and replace string vi