0

Matching the regex /^(?:\.(\d{3}))*$/s on .234.567 produces the following output:

array (size=2)
  0 => 
    array (size=1)
      0 => string '.234.567' (length=8)
  1 => 
    array (size=1)
      0 => string '567' (length=3)

Why is 234 not listed in the second subarray?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
MeinAccount
  • 523
  • 2
  • 6
  • 21

1 Answers1

0

As @develroot already has answered the way you want to use preg_match_all does not work, it will only return the last matching group, not all captures of that group. That's how regex works.

(https://stackoverflow.com/a/6635830/1515333)

Community
  • 1
  • 1
MeinAccount
  • 523
  • 2
  • 6
  • 21