Created
September 11, 2008 20:19
-
-
Save fernandotakai/10303 to your computer and use it in GitHub Desktop.
This file contains 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
CmdUtils.CreateCommand({ | |
name: "regexp", | |
takes: { | |
regexp: noun_arb_text | |
}, | |
modifiers: { | |
with: noun_arb_text | |
}, | |
execute: function(userRegexp, mods) { | |
var text = mods.with.text || ""; | |
var regexp = new RegExp(userRegexp.text, 'gi'); | |
if (regexp.test(text)) { | |
displayMessage("Matched!"); | |
} else { | |
displayMessage("Not Matched!"); | |
} | |
}, | |
preview: "Tries to match an regular expression with an text" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment