Add a character to the beginning and end of a string

If its like Javascript you can do something like...

var myString = "'" + oldString + "'";

Where oldString is your 123456789


You don't need a regular expression.

str = "123456789";

str = "'" + str + "'";

Although this question was asked a little early, newly defined backticks standard called Template Literals from ES6 provides new possibility to solve this question with a simpler syntax:

const str = '123456789';
const wrapped = `'${str}'`;

str = "123456789";
str = str.replace(/^/,"'").replace(/$/,"'")
console.log(str)