Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

match expression. Urgent

I have a text with

{TEST1}+{TEST2}*{TEST4}

I want to retreive the name beetween the "{" and get an array with

TEST1, TEST2, TEST4.

with preg_match all, i can't do that because it take for exemple TEST1}+{TEST2}*{TEST4

Help
0
eeolivier
Asked:
eeolivier
  • 2
1 Solution
 
hernst42Commented:
preg_match_all works (depends on your regular expression)

try:
preg_match_all('/\{[^}]+\}/U', $string, $matches)
0
 
hernst42Commented:
upd forgot () around
preg_match_all('/\{([^}]+)\}/U', $string, $matches)

      
      
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now