在Visual Studio中使用regx搜索解决方案 [英] searching in solution using regx in visual studion

查看:90
本文介绍了在Visual Studio中使用regx搜索解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在支持vb.net项目的旧项目.在那个大型项目中,有很多地方使用3d,4d阵列.我想找出所有使用3d,4d数组的文件.有没有一种简单的方法可以一次找到所有这些对象.我曾尝试在灼热期间对3d数组使用正则表达式.* \(.* \,\ s.* \,\ s.* \),但未返回任何内容.
ter(A,R,P)这是示例3d数组[a,r,p是整数变量]
我知道带有3个参数的函数也具有相同的模式,但是它可以在某种程度上减少我的任务.提前感谢

I am working in support of an old project of vb.net project. In that large project there are lots of place where 3d,4d array has been used. I want to find out all these files where 3d,4d array has been used. Is there any easy way to find all those at a time. I have tried using regular expression .*\(.*\,\s.*\,\s.*\) for 3d array during searing but its returning nothing.
ter(A, R, P) this is sample 3d array[a,r,p are integer variables]
I know the function with 3 arguments also have also same pattern but its can decrease my task to some extent. What would be best way to solve this problem??thanks in advance

推荐答案

,原因是,不应为escaped.因此\,分别解释为\,字符,因此找不到所需的匹配项.

不需要另外的.* 开始,也不需要\s*,因为.也匹配空白.因此可以使用以下模式
\(.*,.*,.*\)
但这与(A, R, P, S) (A, R, P, S, T)等匹配.默认情况下,*量词是贪婪量词,而懒惰量词*?在Visual Studio中不可用.因此,要在搜索模式中排除,,可以使用以下模式

\([^,]*,[^,]*,[^,]*\)
The reason is that , is not to be escaped. So \, is interpreted as \ and , characters separately hence the required match is not found.

Further .* in start is not necessary and \s* is also not necessary as . matches white space too. So the following pattern can be used
\(.*,.*,.*\)
but this matches (A, R, P, S) (A, R, P, S, T) etc. as by default the * quantifier is greedy quantifier and the lazy quantifier *? is not available in Visual Studio. So to exclude , in the search pattern the following pattern can be used

\([^,]*,[^,]*,[^,]*\)


这篇关于在Visual Studio中使用regx搜索解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆