MATLAB: How to replace string that perfectly matchs the string

MATLABstring

The title might be a litle vague, but I am looking to replace a string on a text by another string using regexprep or any other function. However, all my attempts have failed.
For the following example:
str = 'a = 1; b = 2; var1 = a + b; bar1 = a*b;'
If I use regexprep
>> regexprep(str, 'a', 'v1')
ans =
'v1 = 1; b = 2; vv1r1 = v1 + b; bv1r1 = v1*b;'
However, I was looking for:
'v1 = 1; b = 2; var1 = v1 + b; bar1 = v1*b;'
I have been reading the documentation and try differents aproachs, but I could not figure out this. I have a feeling that regexprep can easily solve this problem. I just need to trick this a bit.
Tks in advance, I will keep digging on.

Best Answer

str = 'a = 1; b = 2; var1 = a + b; bar1 = a*b;';
new_str = regexprep(str, 'a\>', 'v1');
Result:
new_str =
'v1 = 1; b = 2; var1 = v1 + b; bar1 = v1*b;'