I have a regex /(.+)_id$/ in a rails application that matches any string that ends with _id . I need it to match any string that ends with _id except associated_id. How can I accomplish this?
thx 🙂
-C
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.
will use negative lookbehind to make sure that whatever was matched by
(.+)doesn’t end inassociated.For languages that don’t support lookbehind, you can use this:
This will assert that it’s not possible to match a string ending in
associated_idfrom the starting position of the string.