var str = "@devtest11 @devtest1"; echographapp.come(/@devtest1\b/g, "aaaa"); Because @ is special character, you need to match it outside of the word. \b assert.
\b - indicates beginning or end of word, so you could create expression like below (\babc\b|\bdef\b|\bhgi\b) you could try it online at Scriptular.
Regex Tester. Regex Tester isn't optimized for mobile devices yet. You can still take a look, but it might be a bit quirky. > Okay!.
Parentheses group the word (go) together. Let's make something more complex – a regexp to match an email. Examples of The search engine remembers the content of each and allows to reference it in the pattern or in the replacement string. For instance, we can each of them is an array with the full match and groups.
The replace() method returns a new string with some or all matches of a times for each full match to be replaced if the regular expression in the first parameter is global. The following script switches the words in the string.