I honestly see no reason to use Regular Expressions in anything simple.
In PHP use explode
and join
$str = '32132132132 32132132132 321321321323 32132132132132';
$exp = explode(' ', $str);
echo "'" . join("';'", $exp) . "'";
See working at repl.it
In Python use split
and < a href="https://docs.python.org/2/library/string.html#string.join"> join
str = '32132132132 32132132132 321321321323 32132132132132';
exp = str.split();
print("'" + "';'".join(exp) + "'")
See working at repl.it
In Java use split
" and join
String link = "32132132132 32132132132 321321321323 32132132132132";
String[] partes = link.split(" ");
System.out.println("'" + String.join("';'", partes) + "'");
See working at repl.it
In JavaScript use and split
let str = '32132132132 32132132132 321321321323 32132132132132';
let res = "'" + str.split(' ').join("';'") + "'";
console.log(res)