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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

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

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