In VB 2010, you can use the implied properties like C# which turns this
Private _SONo As String
Public Property SONo() As String
Get
Return _SONo
End Get
Set(ByVal value As String)
_SONo = value
End Set
End Property
Into
Public Property SONo() As String
What I want to do is replace the old style with the new style in a few file. Since Visual Studio’s find and replace tool allows you to do regular expressions, I assume there must be an expression I can use to do this conversion.
What would the regular expression be to do this conversion?
This could be dangerous as you might have logic in the property setters/getters, but if they don’t have logic you could say:
Regular Expression:
Replace:
I’ve tested this with RegexBuddy targeting the .NET regex variant. Note, that this may or may not work in the Visual Studio Find/Replace prompt as that is yet another variant.
UPDATE: VS’s variant (Dot can’t match newlines so we need to add that functionality, also converted: \w = :a, \s = :b, {} for tags, and *? = @):
The Regex does the following: