How do I find {min,max} repeats with regular expression patterns in Visual Studio or SSMS “Find and Replace”?

放肆的年华 提交于 2019-12-05 08:08:38
Tim Pietzcker

The Visual Studio regex implementation (in versions up until Visual Studio 2010) is a fairly nonstandard one to say the least, and it doesn't have this feature. You can only spell it out:

* or @: Match zero or more of the preceding expression

+ or #: Match one or more of the preceding expression

^n: Match exactly n repetitions of the preceding expression

So for A{2,4} you'd have to use A^4|A^3|A^2 (see polygenelubricant's comment for an explanation why you need to do it in descending order).

More recent versions of Visual Studio support the entire set of .NET regexes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!