I'm working on Android Java application using regex. I'm trying to validate a sentence like: "I want a xxx pizza" by using a pattern like "I want a (TYPEA|TYPEB|TYPEC) pizza".
An example: I set the pattern to "I want a (salami|mushrooms|cheese) pizza" user inputs: "I want a salami pizza" the sentence is matched correctly and group(1) equals to "salami". But if the user inputs: "I want a capricciosa pizza" the whole matcher fails instead of just the group(1). Can the regex being modified in way to avoid the matcher to fail on the whole sentence and make it just to get a null-group at group(1) position?
Hope my explanation is clear.... thanks in advance.