最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Removing backslashes in a string - Stack Overflow

matteradmin4PV0评论

Here is my string, tel:\\99999999999. Everytime I try to open it, it es with a single back slash like \99999999999.

How do I remove both the back slashes so that the phone number bees 99999999999?

Here is my string, tel:\\99999999999. Everytime I try to open it, it es with a single back slash like \99999999999.

How do I remove both the back slashes so that the phone number bees 99999999999?

Share Improve this question edited Oct 30, 2011 at 12:12 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Aug 1, 2011 at 11:38 John CooperJohn Cooper 7,67133 gold badges83 silver badges102 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 5
var tel = 'tel:\\99999999999';
tel = tel.replace(/\\/g, '');

Here is a demo

Try:

var telString = telString.replace("tel:\\\\","");

I think this will help you

stringPath.replace(/^.*[\\\/]/, '')
Post a comment

comment list (0)

  1. No comments so far