RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Flight Number
Expression
^([A-Z]{2}|[A-Z]\d|\d[A-Z])[1-9](\d{1,3})?$
Description
Flight numbers have two parts: The first 2 characters denote the airline's two-letter code. This airline code MUST be either letter-letter, number-letter, or letter-number, NEVER number-number. The 3rd digit has to be a numeric digit from 1 to 9 inclusive. After this 3rd digit, we may append any integer from 0 to 999.
Matches
NW1451 9M116 RG8
Non-Matches
N1265 BZ003
Author Rating: Not yet rated. Mickael Caruso
Source avrefdesk.com
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Wrong
Name: Saulius
Date: 3/13/2013 9:49:54 AM
Comment:
A valid flight number LLC3303 does not match. I'll go with Paul's regex...


Title: Real flight number regex
Name: Paul Ness (UK dev)
Date: 7/8/2011 11:26:10 AM
Comment:
^(([A-Za-z]{2,3})|([A-Za-z]\d)|(\d[A-Za-z]))(\d{1,})([A-Za-z]?)$


Title: Doesn't work
Name: Shaunny
Date: 1/15/2010 8:42:49 AM
Comment:
Try BA0197, which is a valid flight number for a BA flight from Heathrow to Mumbai Airport.


Title: Doesn't work
Name: Shaunny
Date: 1/15/2010 8:42:42 AM
Comment:
Try BA0197, which is a valid flight number for a BA flight from Heathrow to Mumbai Airport.


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials