Skip to content

Instantly share code, notes, and snippets.

@fernandotakai
Created September 11, 2008 20:19
Show Gist options
  • Save fernandotakai/10303 to your computer and use it in GitHub Desktop.
Save fernandotakai/10303 to your computer and use it in GitHub Desktop.
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