regex question

J

Jeff Thies

I need to remove non digits from a number.

I thought I could do this:

var phone='22-p67s82';
var re=/\D/g;
phone=phone.replace(re,'');

alert(phone) yields: 22-p67s82

What dumb thing am I missing. That regex removes nothing.

(I'd leave the non digits in but it's not my site)

Cheers,
Jeff
 
J

Jeff Thies

Sorry.... My mistake, I had this in a perl heredoc and I needed to
escape the "\"


Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top