I want to find a string within a string, here's my scenario:
String toMatch = "ABC";
String matchIn = "ABC*FED";
Other variations of matchIn:
matchIn = "ABC";
matchIn = "ASD*ABC";
matchIn = "JULY*ABC*RTEW";
I have come-up with this regex but it obviously doesn't work:
matchIn.matches(".*(\\*)?" + toMatch + "(\\*)?.*");
The problem here is that I don't know how to look for the "*"
only when it's followed by another word. This way it's just matching everything, e.g.,
toMatch="ABCDEF"
returns true when it shouldn't!