Using the Find in Files feature in Xamarin Studio (Command + Shift + F
) I want to search for this regex:
(^\s*[\/]{2}.*?[;,]$)
with the modifiers gm
Is it possible to use modifiers here? What about in Visual Studio?
Instead of the global modifier /g
, you should look for a Replace all
button or something like that. The multiline modifier can be replaced with its inline counterpart (?m)
that is usually placed at the start of the pattern.
You may use
(?m)^\s*/{2}.*[;,]$
^^^^ ^ ^
Or - in case you want to explicitly match horizontal whitespace after the line start:
(?m)^[\t\p{Zs}]*/{2}.*[;,]$
^^^^^^^^^^
Note I turned the lazy quantifier to the greedy one (.*?
-> .*
) because you want to match a colon or a comma at the end of the line, so a greedy quantifier is more logical to use here.
And /
does not have to be escaped here as the modifiers are not part of the regex here (and has no regex delimiters, /
is often used as a regex delimiter, in JS, PHP, Perl, etc.)