Home>

I'd like to output all "quotes" [. *]"between 4 and 14 characters.

What should I do?

if (preg_match_all ('/ ([(. *?)]) {4,14}/i', "[WordPress] [hogehogehogehogehoge]", $matches, PREG_OFFSET_CAPTURE)) {
  echo var_dump ($matches);
}
// version: PHP 7.0.8
// # =>Ideal output: hogehogehogehogehoge is not output, but WordPress is output
// # =>Actual output: no output
php
  • Answer # 1

    if (preg_match_all ('/ [. {2,12}?]/i', "[WordPress] [hogehogehogehogehoge]", $matches, PREG_OFFSET_CAPTURE)) {
      echo var_dump ($matches);
    }

Related articles