-3

I have this string:

<span itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name">gegi123</span></span>

and i need gegi123

I tried this:

/<span itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name">(.*?)</span></span>/

but that shows an error:

Warning: preg_match_all(): Unknown modifier '/' in /var/www/post/main.php on line 29
Julian
  • 15
  • 3
  • 1
    I'm voting to close this question as off-topic because stackoverflow is not a free code writing service. – l'L'l Aug 16 '15 at 11:51

1 Answers1

1

You need to escape the pattern delimiter to match it literally by a backslash or pick another delimiter.

Unknown modifier '/' ...

Everything after the closing delimiter is considered modifiers/flags:

/<span itemprop="author" itemscope="" itemtype="http://schema.org/Person"...
↑ opening delimiter                                  ↑ closing delimiter
                                                      ↑ php don't know modifier /

With another delimiter: ~<span...http://... ~
 By escaping delimiter: /<span...http:\/\/... /

Community
  • 1
  • 1
Jonny 5
  • 12,171
  • 2
  • 25
  • 42