exists_and_* replace

regex-replace_exists_and.txt
Steps to replace exists_and_not_null and friends

In packages--of course, but don't forget the pages directory

First: find, and manually fix, any instances directly setting a variable to the output of exists_and_not_null or exists_and_equal
set\s*[A-Za-z0-9_\(\)\$]*\s*\[exists_and


for exists_and_not_null:
(aa_(?:true|false).*)\[exists_and_not_null\s*([A-Za-z0-9_\(\)\$]*)\s*\]
\1 [expr {[info exists \2] && $\2 ne ""}]

next:
!\s*\[exists_and_not_null\s*([A-Za-z0-9_\(\)\$]*)\s*\]
(![info exists \1 ] || $\1 eq "")

next:
\[exists_and_not_null\s*([A-Za-z0-9_\(\)\$]*)\s*\]
([info exists \1 ] && $\1 ne "")


for exists_and_equal:
(aa_(?:true|false).*)\[exists_and_equal\s*([A-Za-z0-9_\(\)\$]*)\s*([^\]]*)\]
\1 [expr {[info exists \2] && $\2 eq \3 }]

then:
!\s*\[exists_and_equal\s*([A-Za-z0-9_\(\)\$]*)\s*([^\]]*)\]
( ![info exists \1] || $\1 ne \2 )

finally:
\[exists_and_equal\s*([A-Za-z0-9_\(\)\$]*)\s*([^\]]*)\]
( [info exists \1] && $\1 eq \2 )