Project

General

Profile

« Previous | Next » 

Revision 685

Added by doc over 16 years ago

output_filter: fixed bug in regular expression (eats up characters in mailto links)

View differences:

filter-routines.php
89 89
		define('OUTPUT_FILTER_DOT_REPLACEMENT', $filter_settings['dot_replacement']);
90 90
		
91 91
		// first search part to find all mailto email addresses
92
		$pattern = '#(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?)([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})([^"]*?)"([^>]*>)(.*?)</a>';
92
		$pattern = '#(<a[^<]*href\s*?=\s*?"\s*?mailto\s*?:\s*?)([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})([^"]*?)"([^>]*>)(.*?)</a>';
93 93
		// second part to find all non mailto email addresses
94 94
		$pattern .= '|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b#i';
95 95
		/*
96
		Sub 1:\b(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?)				-->	"<a id="yyy" class="xxx" href = " mailto :" ignoring white spaces
96
		Sub 1:\b(<a.[^<]*href\s*?=\s*?"\s*?mailto\s*?:\s*?)			-->	"<a id="yyy" class="xxx" href = " mailto :" ignoring white spaces
97 97
		Sub 2:([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})			-->	the email address in the mailto: part of the mail link
98 98
		Sub 3:([^"]*?)"																					--> possible ?Subject&cc... stuff attached to the mail address
99 99
		Sub 4:([^>]*>)																					--> all class or id statements after the mailto but before closing ..>

Also available in: Unified diff