It's a good few years since I wrote RegExps and, even when I did, I could never remember whether ^ was start and $ was end or if it was the other way round. My totally untested guess is (assuming spaces are only allowed between components and / or at the start or end) is ^\s*((\+|00)?357\s*)?9[4-79]\s*\d{6}\s*$ or allowing spaces between any numbers (and / or at the start or end) is ^\s*((\+|(0\s*){2})?3\s*5\s*7\s*)?9\s*[4-79]\s*(\d\s*){6}$ Note: I'm allowing all whitespace, to just explicitly permit spaces and exclude other white space, change all of the \s patterns to single space chars I look forward to seeing what someone who actually knows RegExps comes up with to see if I am even remotely close. Edit: I've just re-read the question - you want to extract the text, not just validate it. What I have written above just validates. A simple way to extract would be to, enclose the whole of the text between ^ and $ in parentheses to get a group. Extract the group and then just drop all spaces. e.g. in Javascript
theGroupThatYouHaveFound.Replace(/\s/g, '');
. An even simpler way would be to use the validation RegExp and then remove spaces from the original string (no messing around with groups).