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
  • 31,815
  • 47
  • 169
  • 296
MeinAccount
  • 473
  • 2
  • 6
  • 19

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
  • 473
  • 2
  • 6
  • 19