UNPKG

prisme-flow

Version:

prisme platform flow engine

26 lines (20 loc) 682 B
/** * Created by prisme.io on 09/06/2017. */ module.exports = { email: function (token) { var re = /(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/ var matched = token.match(re) return matched != null ? matched[0] : null }, number: function (token) { var re = /([0-9]+)/ var matched = token.match(re) return matched != null ? matched[0] : null }, url: function (token) { var re = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/ var matched = token.match(re) return matched != null ? matched[0] : null } }