yoda
yoda

Reputation: 10981

PHP PCRE : match braces content

I'm trying to replace the contents inside braces on a string with preg_replace_callback. Here's an example string :

230|321;312|123;{413|333;413|334;413|335};583|221

What I want to do is being able to replace what's inside braces ({413|333;413|334;413|335}) with something else, but I can't quite figure out how to go as for the regex expression. I've tried some but with no results.

Little help?

Thanks!

Upvotes: 0

Views: 195

Answers (1)

Isaac Hildebrandt
Isaac Hildebrandt

Reputation: 1026

If you want to match everything from opening brace to close brace:

/{[^}]+}/

Upvotes: 2

Related Questions