Eclipse PDT: Suche einen Ausdruck, der über mehrere Zeilen geht (multiline search)

Um in Eclipse PDT einen Ausdruck zu suchen, der sich möglicherweise über mehrere Zeilen streckt, kann die Option „Regulärer Ausdruck“ verwendet werden.

Beispiel: Es sollen alle Stellen gefunden werden, in denen nach einem Komma („,“) unmittelbar – abgesehen von Leerzeilen und Leerzeichen) eine geschweifte Klammer („}“) folgt.

Dazu im Suchfenster die Option „Regulärer Ausdruck“ markieren und folgenden Ausdruck im Suchfeld eingeben: ,(\R|\s?)*}

Shorten a text in consideration of getting full words (PHP)

// Does the text need to be shortened?
if (strlen($text) <= $maxLength) {
  return $text;
}
 
$appendString = '...';
// plus 1, because of prepended space to $appendString
$maxLength = $maxLength - (strlen($appendString)+1);
preg_match("/(.{0,$maxLength}\b)/s", $text, $textShort);
 
$shortenedText = (isset($textShort[0]) ? $textShort[0] : '')
               . ' ' . $appendString;
 
// if the text has not enough words to reach minLenght,
// shorten hard.
if (!isset($textShort[0]) ||
    ($minLength !== null &&
     strlen($textShort[0]) < $minLength)) {
 
// minus 1, because of no prepended space to $appendString
$shortenedText = substr($text, 0, $minLength-1)
               . $appendString;

Regular Expression: find all links and souround them with an A-tag (PHP)

// Convert links with [protocol]://...
$content = preg_replace('/(((f|ht){1}tp(s)?:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
'<a href="\\1"' . $attributesString . '>\\1</a>', $content);

// Convert links without [protocol]://...
$content = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i',
'\\1<a href="http://\\2"' . $attributesString . '>\\2</a>', $content);

// Convert mail address
$content = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i',
'<a href="mailto:\\1"' . $attributesString . '>\\1</a>', $content);