Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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
Posted

1 solution

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

\([^,]*,[^,]*,[^,]*\)
 
Share this answer
 
v2
Comments
Rounak Hasan 18-May-12 23:51pm    
its working now but it is also returning a(),a(1,2) .I want to find out only the 3d and 4d array. Is there any option to avoid those unwanted results.
VJ Reddy 19-May-12 12:12pm    
Then it is better to use the following pattern
\([A-Za-z0-9]+,[A-Za-z0-9]+,[A-Za-z0-9]+\)
Rounak Hasan 21-May-12 1:50am    
the pattern doesn't matching with f(a, b_1, c_34) ..Most of array declaration like this.
Rounak Hasan 21-May-12 1:32am    
But strangely its returning 0 results. I am really confused, may be I am doing some mistake.
Rounak Hasan 21-May-12 2:04am    
I have changed it to \([A-Za-z0-9]+[_]*[A-Za-z0-9]*,\s[A-Za-z0-9]+[_]*[A-Za-z0-9]*,\s[A-Za-z0-9]+[_]*[A-Za-z0-9]*\)
But still its returning nothing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900