regex - Getting a number when it has certain prefix from a block of text in PHP -
i have big paragraph , @ random point in string occurs i'd extract:
pid: 45678437
there space before 'pid' , after number, number can 6-10 characters in length.
i need number check preceded pid: there may other large numbers in paragraph.
:)
/ pid: (\d{6,10})/
this match space followed pid:
followed space followed 6-10 digits , capture digits.
i encourage learn regular expressions. powerful tool.
Comments
Post a Comment