Last active
April 14, 2023 15:15
-
-
Save eabay/00ea8454f625bf50286b to your computer and use it in GitHub Desktop.
Türkiye plaka kodu için regular expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validate = (val) -> | |
# boşluk karakterlerini kaldıralım | |
v = val.replace(/\s+/g, '').toUpperCase() | |
# http://tr.wikipedia.org/wiki/Türkiye_il_plaka_kodları adresindeki bilgi kullanılmıştır. | |
regex = /// ^ | |
(0[1-9]|[1-7][0-9]|8[01]) # İl kodu | |
( | |
([A-Z])(\d{4,5}) # "99 X 9999", "99 X 99999" | |
| ([A-Z]{2})(\d{3,4}) # "99 XX 999", "99 XX 9999" | |
| ([A-Z]{3})(\d{2}) # "99 XXX 99" | |
) | |
$ /// | |
v.match(regex)? | |
Dart için;
RegExp(r'^(0[1-9]|[1-7][0-9]|8[01])((\s?[a-zA-Z]\s?)(\d{4,5})|(\s?[a-zA-Z]{2}\s?)(\d{3,4})|(\s?[a-zA-Z]{3}\s?)(\d{2,3}))$')
C# için harf ve rakamlar arasında birer boşluk olacak şekilde nasıl yapabiliriz?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Flutter için kullanımı nedir?