// var tweet = msg.tweet.text;
var tweet = msg.payload;
var newtweet = tweet.replace(/#/g, " Hash tag ");
// regex from https://stackoverflow.com/questions/1500260/detect-urls-in-text-with-javascript
msg.payload = newtweet.replace( /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|biz|com|co|edu|gov|info|net|org|ly))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi, "see short URL " );
return msg;