Regular Expressions (computing): How difficult would it be for Facebook to write a parser that can tell the difference between closing parentheses and the ')'s that occur as part of an emoticon?
-
-
Answer:
I expect that facebook (or anyone else who might care to parse emoticons would write something like this: (\s[:;8X][-']{0,1}[\)\(psD]\s) In english it says this: Look for a two or three character pattern where the first character (the eyes) is either a colon, a number 8, or a capital X, and the last character (the mouth) is a left/right parenthesis, lowercase p, uppercase D, or a lowercase s. Optionally, a single dash, or apostrophe character could be used for the nose, or a tear in the second character of the pattern. Example of the pattern matching on rubular: http://rubular.com/r/NFlNqDlchn This is quite simple - you could start factoring in the non-smilie types of emoticons like (Y), which is commonly a 'thumbs up', or you could tackle those funny reverse smilies everyone is doing these days. (: I suppose that you'd likely want to include in your code (if you are parsing it on the fly) not to try and insert the emoticon if someone has erased the image and typed the same string of text again. If you're trying to figure out how to add a smilie to the end of your paren, for example. As always, there's a relevant xkcd:
Cameron Hurd at Quora Visit the source
Related Q & A:
- How can you tell the difference between a bug bite and something more serious?Best solution by healthtap.com
- How do I write a resume for a part-time job?Best solution by Yahoo! Answers
- How do I write a note on Facebook?Best solution by Yahoo! Answers
- How can you tell the difference between Decidual Bleeding and Menstrual Bleeding?Best solution by ChaCha
- How can you tell the difference between allergies and a cold?Best solution by ChaCha
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.