regex - PHP Find a 15 or 16-digit number in a long string -


i working on function sanitize credit card data replacing digits except last 4 x's. problem have lot of data stored in database json objects. each record may or may not have card number somewhere in it, , occur in different places in text record record (sometimes @ end, in middle, etc.) looking way extract 15-digit or 16-digit numbers string can pass number sanitize function.

looking way extract 15-digit or 16-digit numbers string

you can use:

\b[0-9]{15,16}\b 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -