Changeset 3391

Show
Ignore:
Timestamp:
11/13/06 11:14:37 (2 years ago)
Author:
timothy
Message:

Limit the URL detection some. Prevent MAC addresses from highlighting (require a URL scheme with 3 or more letters). Also prevent lines with double colons from being linked, found in some languages like Perl and C++. #913

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Additions/NSAttributedStringMoreAdditions.m

    r3383 r3391  
    309309- (void) makeLinkAttributesAutomatically { 
    310310        // catch well-formed urls like "http://www.apple.com", "www.apple.com" or "irc://irc.javelin.cc" 
    311         AGRegex *regex = [AGRegex regexWithPattern:@"(?:[a-zA-Z][a-zA-Z0-9+.-]*:(?://)?|www\\.)[\\p{L}\\p{N}$\\-_+*'\"=:\\|/\\\\()%@&#~,;.!?]+[\\p{L}\\p{N}$\\-_+*=:\\|/\\\\()%@&#~]" options:AGRegexCaseInsensitive]; 
     311        AGRegex *regex = [AGRegex regexWithPattern:@"(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:(?!:)(?://)?|www\\.)[\\p{L}\\p{N}$\\-_+*'\\\"=\\|/\\\\()%@&#~,:;.!?]+[\\p{L}\\p{N}$\\-_+*=\\|/\\\\()%@&#~]" options:AGRegexCaseInsensitive]; 
    312312        NSArray *matches = [regex findAllInString:[self string]]; 
    313313        NSEnumerator *enumerator = [matches objectEnumerator];