Reputation: 132
For example, I have the following regular expression:
/lol.*
All strings that matches this expression also matches another expression:
/l.*
How to check that first regex is included into the second one (using JAVA libraries)?
Upvotes: 0
Views: 45
Reputation: 174776
You need to use a lookahead in the second regex inorder to check if the first regex is present in the second or not.
\/l(?=ol).*
In java you don't need to escape forward slash. So the below regex would be enough.
l(?=ol).*
Upvotes: 1