$re = '/(<a\s+.*?href=([\'"]?)\S*\2)/m';
$str = '<li><a href="http://sk1project.org/">sK1</a> is an open source vector graphics editor similar to CorelDRAW, Adobe Illustrator, or Freehand. First of all sK1 is oriented for PostScript processing. UniConvertor is a universal vector graphics translator. It uses sK1 engine to convert one format to another. Development of the import/export modules for this program goes through different stages, quality and feature coverage are different among formats.</li>
<li><a href="http://tango.freedesktop.org/Tango_Desktop_Project">The Tango Desktop Project</a> exists to help create a consistent graphical user interface experience for free and Open Source software. While the look and feel of an application is determined by many individual components, some organization is necessary in order to unify the appearance and structure of individual icon sets used within those components. The Tango Desktop Project defines an icon style guideline to which artists and designers can adhere. A sample implementation of the style is available as an icon theme based upon a standardized icon naming specification. In addition, the project provides transitional utilities to assist in creating icon themes for existing desktop environments, such as GNOME and KDE.</li>';
$subst = "\1 rel=\"nofollow noopener noreferrer\"";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php