Questions tagged [preg-match-all]

A PHP function that performs a global regular expression match using PCRE patterns.

A PHP function that performs a global regular expression match using PCRE patterns.

int preg_match_all ( 
     string $pattern , 
     string $subject 
     [, array &$matches 
     [, int $flags = PREG_PATTERN_ORDER 
     [, int $offset = 0 ]]] 
)

preg_match_all() in the PHP Manual

1934 questions
3
votes
1 answer

preg_quote ignores trailing dot in preg_match_all

Regex preg_match_all('@(\b' . preg_quote($needle,'@') . '\b)@is', $haystack, $matches); Haystack (Job: NAS-Inkrementell) Operation succeeded. Needle Operation succeeded --> works Operation succeeded. --> does not work I did some tests: Alternative…
PrimuS
  • 2,505
  • 6
  • 33
  • 66
3
votes
1 answer

PHP 7 regex not working the same way as in 5

So I have to use php 7 and I have the following regex which works just fine in 5.5 and 5.6. ([\\'\\\"].*[\\'\\\"])([\\s]*[\\s]*=>[\\s]*[\\s])(\\[([^\\[\\]]|(?R))*[\\s]*[\\s]\\])/m when I run this in any version of 5 with preg_match_all I get the…
mbouclas
  • 634
  • 1
  • 12
  • 30
3
votes
4 answers

Regular Expressions: get what is outside of the brackets

I'm using PHP and I have text like: first [abc] middle [xyz] last I need to get what's inside and outside of the brackets. Searching in StackOverflow I found a pattern to get what's inside: preg_match_all('/\[.*?\]/', $m, $s) Now I'd like to know…
cronocr
  • 144
  • 1
  • 5
3
votes
1 answer

How to get all YouTube iframe from HTML using regex

I want to get all YouTube iframe using regex and want to add specific tag to each record found. For example to iframe begeing and end. Needed output: