actionscript-book-WikiEditor-com-example-programmingas3-wikiEditor-URLParser.ax [swf] flex
A utility class that converts URL strings, such as "http://example.com" to HTML anchor links, such as "<a href='http://example.com'>http://example.com>.
Converts HTTP and FTP URLs to anchor links. This function assembles a RegExp pattern out of multiple parts: protocol, urlPart, and optionalUrlPart.
Matches either http:// or ftp://. (?: indicates that the interior group is not a capturing group.
For the URL http://foo.example.com/foo, matches foo.example.
For the URL http://example.com/foo, matches example.
Assembles the pattern from its component parts.
Replaces matching URL strings with a replacement string. The call to the replace() method uses references to captured groups (such as $1) to assemble the replacement string.
Next, find e-mail patterns and replace them with <a> hyperlinks.
Replaces an e-mail pattern with a corresponding HTML anchor hyperlink. Like the urlToATag() method, this method assembles a regular expression out of constituent parts.
Isolates the mailto: part of the string.
Matches the name and @ symbol, such as bob.fooman@.
For the e-mail pattern bob.fooman@mail.example.com, matches mail.example. (including the trailing dot).
Matches the superdomain, such as com, uk, or org., which is 2 - 4 letters.
Assembles the matching regular expression out of constituent parts.
Replaces matching e-mail strings with a replacement string. The call to the replace() method uses references to captured groups (such as $1) to assemble the replacement string.
(C) Æliens 27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.