Just wanted to share something with you all.. a RegEx replace for a specific CF tag..
Hello, all,
For the last several months, I've been working on code that was written many, many moons ago by someone who left for greener fields back in 2013 or 2014. It is chock full of one of my pet-peeves: isDefined().
So, I'm cringing everytime I look at this code with isDefined() all over the place. After several months, I've decided: Every current CF dev at my work knows StructKeyExists() and even (like me) prefers it. I finally decided to do something about it, and I'm sharing it for anyone who is interested.
We use Dw, here, but this will work in any IDE that has a RegEx Find/Replace.
// Find and replace isDefined("{scope}. with StructKeyExists({scope},"
FIND: isdefined\(\s*(['"])\s*(url|variables|server|cgi)\.
REPLACE: StructKeyExists($2,$1
Of course, feel free to add scopes, I just used the four for brevity. I hope someone finds this useful.
V/r,
^ _ ^
