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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -