Results for regex : 3

1 - regex - Is there a regular expression to detect a valid regular expression? - Stack Overflow
/
^                                             # start of string
(                                             # first group start
  (?:
    (?:[^?+*{}()[\]\\|]+                      # literals and ^, $
     | \\.                                    # escaped characters
     | \[ (?: \^?\\. | \^[^\\] | [^\\^] )     # character classes
          (?: [^\]\\]+ | \\. )* \]
     | \( (?:\?[:=!]|\?<[=!]|\?>)? (?1)?? \)  # parenthesis, with recursive content
     | \(\? (?:R|[+-]?\d+) \)                 # recursive matching
     )
    (?: (?:[?+*]|\{\d+(?:,\d*)?\}) [?+]? )?   # quantifiers
  | \|                                        # alternative
  )*                                          # repeat content
)                                             # end first group
$                                             # end of string
/

# Version sans espace ni commentaire :

/^((?:(?:[^?+*{}()[\]\\|]+|\\.|\[(?:\^?\\.|\^[^\\]|[^\\^])(?:[^\]\\]+|\\.)*\]|\((?:\?[:=!]|\?<[=!]|\?>)?(?1)??\)|\(\?(?:R|[+-]?\d+)\))(?:(?:[?+*]|\{\d+(?:,\d*)?\})[?+]?)?|\|)*)$/


			
3 - Rendre des liens cliquables
function makeClickableLinks($text) {  
 $text = preg_replace('/(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)/i',  
 '<a href="1">1</a>', $text);  
 $text = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)/i',  
 '1<a href="http://2">2</a>', $text);  
 $text = preg_replace('/([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})/i',  
 '<a href="mailto:1">1</a>', $text);  
  
return $text;  
}