Skip to content

Instantly share code, notes, and snippets.

@andre-f-paggi
Created October 11, 2016 19:32
Show Gist options
  • Save andre-f-paggi/94608df85b4d7ab42ee808fa7f55915a to your computer and use it in GitHub Desktop.
Save andre-f-paggi/94608df85b4d7ab42ee808fa7f55915a to your computer and use it in GitHub Desktop.
Regex test in JS removeAntesDosNumeros e remove possíveis espaços vazios em dobro
var regexRemoveAntesDosNumeros = new RegExp(/(\D*)(\d*)*(\,(\d|\ )*)/g);
this.value = this.value.replace(regexRemoveAntesDosNumeros, "$2$3$4").replace(/\s+/g,' '); // Remove possíveis espaços vazios em dobro
// test string = a, 595, 535, 563 abc, 523 abcacascas ,543123
// test site https://regex101.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment