You could replace the "find" regex to match both types of quotes: \'"'. $key. '\'"\ = (.+?);/is This will even match: "MegaKey' = UberValue And if I were you, I'd put this configuration file on the list of things to rewrite without regexes.
You could replace the "find" regex to match both types of quotes: '/\\'"'. $key. '\'"\ = (.+?);/is' This will even match: "MegaKey' = UberValue; And if I were you, I'd put this configuration file on the list of things to rewrite without regexes.
The usual way to handle multiple quoting styles is to spell them out: /'a'|"a"/, duplicating what is inside the quotes, though it may very well be slightly different (such as to disallow an unescaped single quote within a single-quoted string. '/\("'. $key.'"|\''.
$key. '\')\ = (.+?);/is' You can also, sometimes, use a back reference: '/\(\'")'. $key.
'\\1\ = (.+?);/is.
1 nice options; I do think the back reference needs a double escape like \\1 – Andomar Nov 22 '09 at 15:44 Thanks, been using raw string literals too much lately. :) – Roger Pate Nov 22 '09 at 16:33 +1 the backref is the best solution here, less likely to accept nonsense 'asdf". \\1 would be necessary if the regex was in double quotes.
– scribble Nov 22 '09 at 16:36.
Well, you can do back-referencing to match the correct set of quotes used (opened with double, closed with double) preg_replace( '/\(\"\'+)'. $key. '\\1\\s=\s(.+?);/is', '\\1'.
$key. '\\1 = '. $newValue.
';', $contents); \\1 matches the first type of quote used.
1 is it intentional to match any number of quotes like "'"key"'" – Andomar Nov 22 '09 at 15:46 well, we can also match only one quote too using the {1} – thephpdeveloper Nov 22 '09 at 15:52.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.