In the case of / \ b @ MYVAR \ b / i, I can not use boundary, See: link I need to validate a string that contains a @MYVAR (Example) word.
Are there any restrictions on this character? What would be an alternative?
I tested javascript and the result is false.
console.log('/\b@MYVAR\b/i.test("@MYVAR")',/\b@MYVAR\b/i.test("@MYVAR"));
In php the code would look something like this:
<?php
$value = "@MYVAR";
if(preg_match("#/\b@MYVAR\b/i#i", trim($value))){
echo "ok";
}