+def re_var(var):
+ """
+ Generates a regexp for assignment to ``var`` in PHP; the quoted
+ value is the second subpattern.
+
+ >>> re_var('key').search("$key = 'val';").group(2)
+ "'val'"
+ """
+ return re.compile('^(\$' + app.expand_re(var) + r'''\s*=\s*)(.*)(;)''', re.M)
+
+def re_define(var):
+ """
+ Generates a regexp for the definition of a constant in PHP; the
+ quoted value is the second subpattern.
+
+ >>> re_define('FOO').search("define('FOO', 'bar');").group(2)
+ "'bar'"
+ """
+ return re.compile('^(define\([\'"]' + app.expand_re(var) + r'''['"]\s*,\s*)(.*)(\);)''', re.M)
+
+def _make_filename_regex(var):