I need something besides [^0-9\\n], I want a regex(but dont know how to make one), that captures anything in a pattern of numbers like this, \"0000000000\" or \"000-000-0000
I always forget this one myself and go hunting the internet for the answer. Here it is, for my future reference, and the rest of the internet
const rawNumber = '(555) 123-4567';
const strippedNumber = rawNumber.replace(/\D+/g, '');
Of course, my above example is JavaScript specific, but it can be adapted to other languages easily. The original post didn't specify language.
You can search for all non-digits using:
\D+
OR
[^0-9]+
And replace by empty string.