I have strings that are concatenations of airline codes/flightnumbers, separated with ;
. The airline code and flight number are either separated by a space or
-
. So some examples are:
AA-1234;UA 243;EK 23;
9W 23;B6-134
Now I want to grab the airline codes from this.
I came up with the following regex: [a-zA-Z0-9]{2}[ -]
. This works to grab the airline codes but also includes the airlinecode-flightnumber separator. How would I adjust my regex to not include this?