Max Baldwin
Max Baldwin

Reputation: 3472

Remove Backtick From String

I am using the npm 'mysql' for a Node app I am working on. At one point that app saves a link to a table. In order to add the link to the table I have to use the npm's escapeId() function.

My issue is that when I got to retrieve that link from the database I get something like this:

'`http://bit`.`ly/2yy0foe`'

I am not having an issue splitting the string at the period. I am having an issue getting rid of the backticks. Any suggestions? Using the npm or any other method.

Thanks,

Upvotes: 1

Views: 6783

Answers (1)

scrappedcola
scrappedcola

Reputation: 10572

Use replace to remove the unwanted characters.

var newStr = '`http://bit`.`ly/2yy0foe`'.replace(/`/g, "");

Upvotes: 11

Related Questions