I've found plenty of old threads that recommend using \b to delineate words in a text document, so you can replace whole words, but I have expressions that contain words that might not be delineated by whitespace, such as
MyFunction(Fred, True, False, MyVariableIsTrue, x==true?a:b)
In this case I want to end up with
MyFunction(Fred, 1, 0, MyVariableIsTrue, x==1?a:b)
So my current code
return expr
.replace(/true/gi, "1")
.replace(/false/gi, "0")
isn't going to work because MyVariableIsTrue will become MyVariableIs1, whereas the \b method won't convert the x==true?a:b part
How can I do regex this so it will match "whole word" instances of true and false (case independently) ? thanks