Basically you almost provided the answer to your question by yourself.
In smarty you've got your variable $var
and you are using the smarty variable modifier regex_replace to do a regular expression search and replace on this variable.
The smarty variable modifier regex_replace requires two parameters:

Both parameters are of type string
. The parameters in a smarty variable modifier are separated by a colon.
In your first code example
{$ver|regex_replace:"/something/":"<div class="xyz">anything</div>"}
your first parameter is "/something/"
, but the second one is broken because you don't escape the quotation marks!
In your second code example
{$ver|regex_replace:"/something/":"<div>anything</div>"}
you removed the class attribute on your div, so you do not have the problem with escaping the quotation marks any more. That's why your second code example is working.
With that in mind, you can now correct your first code example by escaping the quotation marks
{$ver|regex_replace:"/something/":"<div class=\"xyz\">anything</div>"}
or you can use single quotes, like suggested in comments:
{$ver|regex_replace:"/something/":"<div class='xyz'>anything</div>"}
Personally I prefer to use single quotes.