When I get the json from the rest api, it comes in plain text. I need to convert the @..’s and #..’s to actual links. Anyway to do that with javascript?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assume
textto be the string containing the message. A Regular expression can easily convert the @’s and #’s to links. Thereplacefunction takes two arguments:@(\S+)means: “Match any non-whitespace after@, and group the non-whitespace characters(\s+))$1refers to the grouped match at 1.Code: