Hey All,
Is it possible for me to create a regex which indicates something along these lines:
Pattern.compile("marsu[pial]");
where
Pattern matches only "marsup", "marsupi", "marsupia", and "marsupial"?
I had originally thought it was, and that was the proper syntax, but then I realized that the above regex also matches "marsul", or any of the other bracketed letters or combination thereof.
After doing some research the best I can come up with is:
Pattern.compile("(marsup)|(marsupi)|marsupia)|(marsupial)");
But that's not really working for me efficency-wise, nor does it seem much better than simply creating
String[] and running String.equals.
Thank you.