Skip to content

Instantly share code, notes, and snippets.

@ObjectIsAdvantag
Last active June 22, 2016 05:37
Show Gist options
  • Save ObjectIsAdvantag/ef11d03606587c681fe3da53d9df1e05 to your computer and use it in GitHub Desktop.
Save ObjectIsAdvantag/ef11d03606587c681fe3da53d9df1e05 to your computer and use it in GitHub Desktop.
Built.io RegExp NodeJS filter
// for completing this activity and exporting data to next
// activity use $export(error, data)
// More help can be found here: http://bmp.io/4uih3ej
// sample text provided by user
var text = $params.text;
// regex to match and extract pattern user want
var data = text.match(/^(\/sms)\s+([+\d]+)(.+)/);
if(data && Array.isArray(data) && data.length){
// removing first item containg full text in array;
data.shift();
}
// now parameters is an array containing
//["/sms", "+33678007834", "call me ASAP please"];
$export(null, {data : data});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment