vs.net find help, how to search for all lines that contain 2 stringsusing regex?

  • Thread starter Thread starter DotNetNewbie
  • Start date Start date
D

DotNetNewbie

Hello,

In VS.NET, I assume the 'Find' tool lets you search using regular
expressions right?

How would I search for all lines in my project that contain 2 strings
(anywhere in the line, in any order)?

Example, the 2 strings could be: 1) script 2) text
 
Hello DotNetNewbie,
Hello,

In VS.NET, I assume the 'Find' tool lets you search using regular
expressions right?

How would I search for all lines in my project that contain 2 strings
(anywhere in the line, in any order)?

Example, the 2 strings could be: 1) script 2) text

Visual Studio uses a very nasty variation of Regex. Which is always very
frustrating for me to use. There are even 3rd party implementations of Find&Replace
which use the standard .NET flavour of regex instead.

The regex that works for me is:

{text.*script}|{script.*text}
 
Hello,

In VS.NET, I assume the 'Find' tool lets you search using regular
expressions right?

How would I search for all lines in my project that contain 2 strings
(anywhere in the line, in any order)?

Example, the 2 strings could be: 1) script 2) text
It might be simpler and more maintainable to separate the two
searches.

Pseudocode:

for each string str in lines[] do
if (str contains "script" and str contains "text") then
doStuff(str)
endif
endfor

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top