tags:

views:

23

answers:

2

I have a situation where using VBScript I need to check for the presence of multiple spaces. I want to check for the presence of 2 or more consecutive spaces, so \s+ doesnt work for my needs.

Does anyone know how I can accomplish this using VBScript regular expressions.

A: 

This ought to do the trick:

\s{2,}
Robusto
Thanks for your answers.This seems to also replace new line characters.
Mick
FYI using {CR}{LF}
Mick
try `[ ]{2,}` then. You don't really need the brackets around the space, but it's hard to show the space in a comment here. Or do it as Guffa shows, using \x20 (representing the ASCII value of the space character. Either way, show your appreciation by upvoting us and/or giving someone a checkmark if our answers helped you.
Robusto
+1  A: 

Use brackets to specify how many repetitions to match. This matches two or more whitespace characters:

\s{2,}

If you want to match only space characters, just use a space instead of \s, or the character code:

\x20{2,}
Guffa
+1 because we got the same answer at the same time, but I got the check.
Robusto