I want to exclude a specific number like 4800 from a string of numbers like 569048004801.
I’m using php for this and the method preg_match_all some pattern’s examples I have tried :
/([^4])([^8])([^0])([^0])/i
/([^4800])/i
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This actually says, a sequence of four characters that is not “4800”. Close.
This actually says, a single character that is not ‘4’, ‘8’, or ‘0’.
Assuming you mean to capture a number that doesn’t contain “4800” in it, I think you might want
This says, check first that we’re not looking at a string of numbers with “4800” somewhere, and provided this is the case, capture the string of numbers. It’s called a “negative lookahead assertion”.