Currently I'm studying the regexps of twitter text js repo on github. As you're a great contributor I was wo ndering if I could ask you some questions. If you have some time, could you please answer the following questions?
The questions are about the following regexps:
1) twttr.txt.regexen.endHashtagMatch = regexSupplant(/^(?:#{hashSigns}|:\/\/)/);
2) twttr.txt.regexen.hashtagBoundary = regexSupplant(/(?:^|$|[^&a-z0-9_#{latinAccentChars}#{nonLatinHashtagChars}])/);
3) twttr.txt.regexen.validHashtag = regexSupplant(/(#{hashtagBoundary})(#{hashSigns})(#{hashtagAlphaNumeric}*#{hashtagAlpha}#{hashtagAlphaNumeric}*)/gi);
4) twttr.txt.regexen.endMentionMatch = regexSupplant(/^(?:#{atSigns}|[#{latinAccentChars}]|:\/\/)/);
5) twttr.txt.regexen.validReply = regexSupplant(/^(?:#{spaces})*#{atSigns}([a-zA-Z0-9_]{1,20})/);
Question 1:
Regexp 2 is used for some kind of boundary, but it starts with ^|$ . This means the beginning or ending of a line, but as you can see in regexp 3, that it's at the beginning of a regexp, why is the $ over there? Is this because of the support for the rtl languages?
Question 2:
At the end of regexp 2 there's something like :// , where is this used for? I can't figure it out. In regexp 4 something similar happens.
Question 3:
At the beginning of regexp 2 there's something like |[^&a-z0-9 , what does the & mean in this context?
Question 4:
Where is regexp 1 and 4 used for? What does the endHashtagMatch and endMentionMatch do?
Question 5
Regexp 3 has #{hashtagBoundary} at the beginning, why doesn't have regexp 5 something similar.