Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex in Visual Studio: How to comment out all lines that contain "xyz"?

In Visual Studio 2008, using Regex, how do I comment out all lines containing the text "xyz"?

like image 210
Douglas Avatar asked Mar 01 '10 20:03

Douglas


2 Answers

Find what: ^.*xyz.*

Replace with: //\0

use: Regular expressions.

like image 196
Paul Creasey Avatar answered Sep 18 '22 13:09

Paul Creasey


^(.*xyz.*)$

Replace with

// \0

Should do the trick I think. (Not 100% positive here... testing now)

EDIT: Fixed (it's \0 not \1).

Billy3

like image 36
Billy ONeal Avatar answered Sep 22 '22 13:09

Billy ONeal