On 2014-12-18 23:31, Christian Schneider wrote:

Regex is one of my weaknesses. If you don't mind sharing yours (and if
you have them still lying around) please send to schneider at
gerzonic.net, this would be greatly appreciated, and would make my life
a bit easier.

These are two simple regular expression that you can use:


Replace with

) @selector("$1");



Replace with

) @selector("$1")

They make some assumption about the code. They will match:

a closing parenthesis ->
zero or more spaces ->
opening bracket ->
at least one or more of: A-Z, a-z, a colon or 0-9 ->
closing bracket ->
semicolon ->
end of line

In the above description the arrow, "->", should be read as "followed by".

When replacing the text, $1 will represent what's caught in the first group. In this case what's in between the brackets.

The difference between the first and the second regular expression is the trailing semicolon, to handle both extern declarations and methods defined in the D source code.

These regular expression assume you only have the selector on the right side of the method declaration, i.e. no UDA's or similar.

/Jacob Carlborg

Reply via email to