Question: Java qusetion about regular expressions A flight designator is the concatenation of the airline designator and the flight number. The airline designator consists of two
Java qusetion about regular expressions

A flight designator is the concatenation of the airline designator and the flight number. The airline designator consists of two alphanumeric characters (Any letter from the English alphabet or a digit) followed by an optional letter. The flight number consists of between 1 to 4 numeric characters (digit) and an optional one letter operational suffix. All characters are in uppercase. Implement a regular expression as a Java String p like so: String p = "*****************"; such that ***************** is a regular expression pattern that will match any String that contains an flight designator, and only such strings. Your answer must include the whole line of code above, meaning that the ***************** must be properly backslash-escaped both in terms of backslash escapes required for regular expressions and any backslash escapes required to put the expression inside the quotes above. Your answer will be inserted automatically into a test method match() like so: public void match(String s){String p = "*****************"; System.out.println(s.match(p)? "match" + s: "does not match" + s);} The test cases will invoke this method. Example: The following are valid flight designators: NZ7 LH7156 SQI6352F 8973 The following are invalid flight designators: Qfl34 9082Re For example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
