Created
March 9, 2010 03:43
-
-
Save cehoffman/326130 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegExp.prototype.toString: () -> | |
flags: { | |
i: @ignoreCase | |
g: @global | |
m: @multiline | |
} | |
# Firefox 3 specific flag | |
flags.y = @sticky if @sticky? | |
[on_flags, off_flags]: ['', ''] | |
for flag, status of flags | |
if status then on_flags += flag else off_flags += flag | |
"(?$on_flags${if off_flags.length > 0 then "-$off_flags" else ''}:$@source)" | |
puts /\d+/igm | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment