views:

30

answers:

2

Using visual studio search and replace, is there a way to search for two or more instances of something? Visual Studio regex does not seem to support the "{}" syntax for indicating quantity.

E.G:

Match Text: 11 OR 111 OR 1111
Standard Regex: [1]{2,}
A: 

To do "two or more" you have to repeat yourself to match one and then one-or more.

11+

or

[1][1]+

(the latter is only useful if you want more than one digit to match, e.g., [123][123]+.)

Tim Sylvester
A: 

The you could try:

11+
// or
111*

Which would result in the same (matches 2 or more '1'-s).

Bart Kiers