Reputation: 32350
0 10 2 012 11 12 12 test -f 13 x xx
0 2 102 012 12 12 test -f 11 xxddd 22x
0 102 01 2 1 12 12 test -f 12 xxx
I need to find the number (between 1 and 5 digits) following the -f
parameter using preg_match()
.
I'm a total bumpkin regarding PCRE matches.
I played arround with online preg testers and get stuck with \(.*)-f(\d{1,5})(.*)$\
Upvotes: 1
Views: 64
Reputation: 32350
Oh I didnt notice how close I got it:
\^.* -f (\d{1,4}).*$\
Array
(
[0] => 0 10 2 012 11 12 12 test -f 13 x xx
[1] => 13
)
Upvotes: 1