Skip to content

Instantly share code, notes, and snippets.

@AzrizHaziq
Last active May 25, 2021 13:46
Show Gist options
  • Save AzrizHaziq/0031c0423799b579e258cab675505373 to your computer and use it in GitHub Desktop.
Save AzrizHaziq/0031c0423799b579e258cab675505373 to your computer and use it in GitHub Desktop.
Common Malaysia Regex
// Malaysia new IC
const icRegEx = new RegExp(/\d{6}-\d{2}-\d{4}/)
icRegEx.test('931223-14-6957') // true
icRegEx.test('931223146957') // false
@AzrizHaziq
Copy link
Author

Todo No Tel, no plates

@AzrizHaziq
Copy link
Author

AzrizHaziq commented Jul 29, 2018

((Putrajaya) [1-9]\d{0,3}) (?# Putrajaya)
(H[ABCDEJKLMNPQRSTW][A-Y] [1-9]\d{0,3}) (?# Taxi)
(Z[ABCDLUZ] [1-9]\d{0,3}) (?# Military)
(LIMO [1-9]\d{0,3} [WB]) (?# LIMO)
(\d{2}-\d{2}-(DC|UN)) (?# DC&UN)
(Q[AKLRBMSCPT][A-Y] [1-9]\d{0,3} [A-Y]) (?# SArawak)
(L[A-Y] [1-9]\d{0,3}) (?# Labuan)
(S([YGSBKTDLU][A-Y]|A[A-C]|SA|TA) [1-9]\d{0,3} [A-Y]) (?#Sabah)
(KV [1-9]\d{0,3} [A-Y]) (?# Langkawi)
^(([ABCDFJKMNPRTW][A-Y]{1,2} [1-9]\d{0,3})(?<!(BAB 1))) (?# all except BAB 1)
WIP

((Putrajaya) [1-9]\d{0,3})(?# Putrajaya)|(H[ABCDEJKLMNPQRSTW][A-Y] [1-9]\d{0,3})(?# Taxi)|(Z[ABCDLUZ] [1-9]\d{0,3})(?# Military)|(LIMO [1-9]\d{0,3} [WB])(?# LIMO)|(\d{2}-\d{2}-(DC|UN))(?# DC&UN)|(Q[AKLRBMSCPT][A-Y] [1-9]\d{0,3} [A-Y])(?# SArawak)|(L[A-Y] [1-9]\d{0,3})(?# Labuan)|(S([YGSBKTDLU][A-Y]|A[A-C]|SA|TA) [1-9]\d{0,3} [A-Y])(?#Sabah)|(KV [1-9]\d{0,3} [A-Y])(?# Langkawi)|(([ABCDFJKMNPRTW][A-Y]{1,2} [1-9]\d{0,3}( [A-Y])?)(?<!(BAB 1)))(?# common)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment