Skip to content

Instantly share code, notes, and snippets.

@johnnyw66
johnnyw66 / gist:4732429
Created February 7, 2013 17:04
Flash to C# Regular Expressions
// sort out some getters and setters for private variables - replace a getter with a C# get and set functions
// We've assumed that were there is a getter - there's also a getter! Remove by unwanted function by hand.
public\s*function\s*get\s*([a-zA-Z]+)\(\s*\)\s*:\s*([^\s]+)\s*{\s*return\s*_[A-Za-z_]+\s*;\s*}
public $2 $1 { get { return _$1 ; } set { _$1 = value ; } }
// remove old Flash setter. FUDGE here - replacing with 1st WhiteSpace we see.
public(\s*)function\s*set\s*([a-zA-Z]+)\([^\)]+\)\s*:\s*void\s*{\s*_[A-Za-z_]+\s*=\s*[^;]+;\s*}
$1
// sort out return type in