Backboards: 
Posts: 150
In response to "Uh? Like old school barely recognizable limited characters commands? Like if one programmed using only the Vic 20 symbolic shortcuts?" by JD

It's used thousands of times a day inside dozens of programming languages and applications, including SlackerTalk -- (edited)

The matching part in particular is useful for detecting when link embedding may be possible, like so:

#^https?://[^/]*\.?twitter\.com/status/.*$#

Edit: I think I got most of the syntax right. It basically says, accept strings that start with http, then an optional "s", then the normal :// part, then anything as the subdomain (the * means 0 to infinity, and the [^/] means, as long as the character is not a "/"), then twitter.com/status/ (the dot after twitter is escaped because normally it's a wildcard character), the unescaped .*$ means "any character repeating until the end of the string".

If this gets run against a twitter post URL, it'll return "true"; any other URL would return false, and that's how the code knows it's a twitter post.


Post a message   top
Replies are disabled on threads older than 7 days.