0

I am getting the error in this code:

$pattern="{[^}]*}";

$this->output = preg_replace($pattern, "", $this->output);
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • Possible duplicate of *[Warning: preg_replace(): Unknown modifier '\]'](https://stackoverflow.com/questions/20705399/warning-preg-replace-unknown-modifier)* (same reason, missing regular expression delimiters) – Peter Mortensen Jul 04 '19 at 10:56

1 Answers1

0

You need to escape the curly bracket:

$pattern="{[^\}]*}";

If your delimiters are { and }.

But I think you miss the regular expression delimiter:

$pattern="/\{[^\}]*\}/";
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Toto
  • 89,455
  • 62
  • 89
  • 125