Last active
June 22, 2016 05:37
-
-
Save ObjectIsAdvantag/ef11d03606587c681fe3da53d9df1e05 to your computer and use it in GitHub Desktop.
Built.io RegExp NodeJS filter
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
// 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