7
In the case of / b@MYVAR b/i, I cannot use Boundary, See: https://regex101.com/r/4bFElA/1 I need to validate a string that contains a @MYVAR word (Example).
Are there any restrictions on this character? What would be an alternative?
I did a javascript test 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";
}
In what language are you going to use this regex? Can you explain better the problem you are trying to solve?
– Sergio
I need to validate a string that contains a word @MYVAR, posted an example in javascript but could be in php or any other language.
– LeonanCarvalho
friend, have you tried using regex (@userid)? @Leonancarvalho
– Paz