Reputation: 3491
I have a string and i want to know if it includes some pattern in the end of it. I want to know if it has "jobs" or "jobs/" the "/" is optional for example:
www.example.jobs/ www.example.jobs
So far i have this:
\.(com|org|edu|net|jobs?/|gov)$
The problem is that if i have a string that ends with "jobs" it doesn't catch it.
Upvotes: 0
Views: 70
Reputation: 26667
Just add ?
optional quantifier to /
\.(com|org|edu|net|jobs?/?|gov)$
/?
ensures that the /
is matched zero or one time, making it optionalUpvotes: 1