Это может быть опасно, поскольку у вас может быть логика в установщиках / получателях свойств, но если у них нет логики, вы можете сказать:
Регулярное выражение:
Private\s_(\w+)\sAs\s(\w+).*?(^\w+).*?Property.*?End\sProperty
Заменить:
${3} Property ${1} As ${2}
Я проверил это с помощью RegexBuddy, нацеленного на вариант регулярного выражения .NET.Обратите внимание, что это может работать, а может и не работать, в приглашении Найти / Заменить Visual Studio, поскольку это еще один вариант.
ОБНОВЛЕНИЕ: вариант VS (точка не может соответствовать символам новой строки, поэтому нам нужночтобы добавить эту функциональность, также преобразуются: \ w =: a, \ s =: b, {} для тегов и *? = @):
Private:b_{:a+}:bAs:b{:a+}(.|\n)@{:a+}(.|\n)@Property(.|\n)@End:bProperty
\3 Property \1 As \2
Regex выполняет следующие действия:
Options: dot matches newline; case insensitive; ^ and $ match at line breaks
Match the characters “Private” literally «Private»
Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s»
Match the character “_” literally «_»
Match the regular expression below and capture its match into backreference number 1 «(\w+)»
Match a single character that is a “word character” (letters, digits, and underscores) «\w+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s»
Match the characters “As” literally «As»
Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s»
Match the regular expression below and capture its match into backreference number 2 «(\w+)»
Match a single character that is a “word character” (letters, digits, and underscores) «\w+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match any single character «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the regular expression below and capture its match into backreference number 3 «(\w+)»
Match a single character that is a “word character” (letters, digits, and underscores) «\w+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match any single character «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the characters “Property” literally «Property»
Match any single character «.*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the characters “End” literally «End»
Match a single character that is a “whitespace character” (spaces, tabs, and line breaks) «\s»
Match the characters “Property” literally «Property»