← Back to challenges

Twitter Link Finder

JavaScriptHardregexformatting

Instructions

Your job is to make a "Twitter link" regular expression rx. This RegEx searches a tweet to find the @handle and the #handle.

  • The function is already written in the Tests tab, so you only need to provide the RegEx variable in the Code tab.
  • Only return the @ and # handles.

Examples

tweet("Visit us at @innokodakademija") ➞ "@innokodakademija"

tweet("Follow @JavaScript") ➞ "@JavaScript"

tweet("#Honesty is the best @policy!!") ➞ "#Honesty @policy"

Notes

Make sure the RegEx doesn't return . , ! ?, etc.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Is the Phone Number Formatted Correctly?