Javascript regex delete number then space?

How can I remove numbers and space from the beginning of a line?

For example, from '13 Adam Court, Cannock ', remove' 13 '.

+5
source share
4 answers

Search

/^[\s\d]+/

Replace the empty string. For instance:

str = str.replace(/^[\s\d]+/, '');

This will remove the numbers and spaces in any order from the beginning of the line. For something that only removes the number followed by spaces, see BoltClock Answer.

+9
source
str.replace(/^\d+\s+/, '');
+6
source
var text =  '13 Adam Court, Cannock';
var match = /\d+\s/.exec(text)[0];
text.replace(match,"");
0

. .

var sRegExResult = "Regex Sample99";
sRegExResult.replace(/\s|[0-9]/g, '');
0

All Articles