-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Muhammad Nabeel Arif edited this page Mar 7, 2016
·
1 revision
The main purpose of the project is to address and provide solution of one of the problems faced by HipChat team.
This app allows a user to input a chat message string and convert it into a JSON string containing information about its contents. Special content to look for includes:
- @mentions A way to mention a user. Always starts with an '@' and ends when hitting a non-word character. How do mention work
- Emoticons - For this exercise, you only need to consider 'custom' emoticons which are alphanumeric strings, no longer than 15 characters, contained in parenthesis. You can assume that anything matching this format is an emoticon. Emoticons
- Links - Any URLs contained in the message, along with the page's title.
For example, calling a function with the following inputs should result in the corresponding return values.
Input:
"@chris you around?"
Output:
{
"mentions": [
"chris"
]
}
Input:
"Good morning! (megusta) (coffee)"
Output:
{
"emoticons": [
"megusta",
"coffee"
]
}
Input:
"Olympics are starting soon; http://www.nbcolympics.com"
Output:
{
"links": [
{
"url": "http://www.nbcolympics.com",
"title": "NBC Olympics | 2014 NBC Olympics in Sochi Russia"
}
]
}
Input:
"@bob @john (success) such a cool feature; https://twitter.com/jdorfman/status/430511497475670016"
Output:
{
"mentions": [
"bob",
"john"
],
"emoticons": [
"success"
],
"links": [
{
"url": "https://twitter.com/jdorfman/status/430511497475670016",
"title": "Twitter / jdorfman: nice @littlebigdetail from ..."
}
]
}