Hopefully a quick question, I'm getting an error message when comparing variables. In developing an inputselect dialog, I need to compare two strings such that I can have the ones that match, pre-checked. One string of variables is a listing of all current user buttons CTBs and XY built-in buttons currently on the toolbar and the other string is a listing of "all" buttons available in XY also including the CTBs (some are not used). I've tried a number of different methods, but I receive and an "Invalid pattern string" error message. I believe it's due to the format of some of the strings yet they are identical. I've cross-checked that. The comparisons that don't have the ":" or "[" will work.
Code: Select all
Invalid pattern string
"CTB 13: [L-drag] Meta [R-drag] Set Wallpaper [L] Pic Thumbs [no TB] [R] Pic Thumbs [w TB]" LikeI "CTB 13: [L-drag] Meta [R-drag] Set Wallpaper [L] Pic Thumbs [no TB] [R] Pic Thumbs [w TB]"
So I ran a simplified test to see what was happening using this code. Quoting or not it fails.
Code: Select all
$TB = "CTB 13: [L-drag] Meta [R-drag] Set Wallpaper [L] Pic Thumbs [no TB] [R] Pic Thumbs [w TB]";
$UB = "CTB 13: [L-drag] Meta [R-drag] Set Wallpaper [L] Pic Thumbs [no TB] [R] Pic Thumbs [w TB]";
if ($TB LikeI $UB) {echo they match; }
else {echo "They don't match even though they are the same"; }
I've tried quoting the strings and using SC quote, and even tried RegexMatches but it fails when it's comparing a CTB that has characters like "[" and ":". Does XY fail when comparing strings which have some of thes characters like "]" or ":" ? Thanks,
Ken