Regex to Find Second Char is Alpha up to 5 Alpha Followed by 1 numeral.
Thanks
Regex to Find Second Char is Alpha up to 5 Alpha Followed by 1 numeral.
Thanks
.\w{1,5}\d
any character followed by between 1 and 5 letters then 1 number
Double-checking...
Yes?
Assuming first character is irrelevant:
/.[A-Za-z]{1,6}\d/
This should do the trick. Regular expression language is .Net implementation
^.[a-zA-Z]{1,5}\d$
Breakdown
[a-zA-Z
]{1,5
} will match any character a-z at least one time but no more than five. Because of the preceeding "." this means that the match will start at the second characterI was not successful in implementing any of the solutions above, probably my poor explanation of need. I did solve it in code not using Regex. Thanks to everyone who took the time to help. For those that thought this was homework, it was not.
Here is some sample data.
Need this
I INDY2 ' INDY VECTOR DP FOR FILING '041802 REM 59268640 I JODUB3 ' AIRWAY FOR JODUB SID '051205 CLW 59268649
Don't need this
I J149 ' GDK 59265224 I APE074 ' 43092 REF 59265777
This is how I tested in code.
Dim IsSidStar As Boolean = False
If aAirways.Name.Length > 2 Then
Dim a2ndChar As Char = aAirways.Name(1)
Dim alastChar As Char = aAirways.Name(aAirways.Name.ToString.Length - 1)
Dim a2ndlastChar As Char = aAirways.Name(aAirways.Name.ToString.Length - 2)
If Char.IsLetter(a2ndChar) = True AndAlso Char.IsNumber(alastChar) = True AndAlso Char.IsNumber(a2ndlastChar) = False Then
IsSidStar = True
End If
End If