For example my string is:
"Hi @randomperson !! how are you?"
and if I have to get all characters starting from the @ to the space before the exclamation marks.
Any help is appreciated 🙂
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.
Use a regular expression:
/) are regex literal delimiters@matches a single@character\S+matches one or more non-whitespace characterThat’s it.
More information on regex in JavaScript: http://www.regular-expressions.info/javascript.html.