preg_split("/({{\s*(?:(?!}}).)+\s*}})/s", file_get_contents('data.txt'));
That line makes Apache reset the connection. data.txt is approximately 12 kB.
What am I doing wrong, can I optimize the regex somehow?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this regular expression instead:
The main improvements:
(?>…)– atomic grouping to avoid backtracking(?:[^}]|}[^}])+– no look-around, no non-greedy matching