php Select long string between 2 characters

I have a working solution to this already. But, it also has a big flaw.
Here is what i have, it is with regex ofcourse:

  'preg_match_all("/[{].*[}]/","{SOMETHING BETWEEN BRACKETS}",$codes);'

This is absolutly fine if the string is small, but it does not work for a big string. I know you can set the limit higher in the php.ini with ini_set. This can cause a php crash if it is too high.

Now i thought of getting the stringpos of 1 char and then the strpos of the other and loop through it. This has the complication if there are more then 1 brackets, and is not that efficient. Is there another way to select a big string between 2 characters?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.