E
E
Emil Gimranov2021-07-02 16:57:58
JavaScript
Emil Gimranov, 2021-07-02 16:57:58

How to make an exception in a regular expression?

Each flight is assigned a unique identification number according to the following pattern “3 letters (Latin, any case) - (hyphen) cargo number (from 0 to 1000, excluding the following numbers: 777 and 315) - (hyphen) from 1 to 3 letters (Cyrillic) , uppercase) For example: jDT-123-L , kSR665-êGA There should be no response to the following cargo numbers (for example: kdO-315-u or jtfd-777-ShAP).

There are some developments in this regard ([Az]{3})-(\d{1,3})-([A-Z]{1,3})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-07-02
@Knorke

If there is no support for negative lookahead (?!...), then you can try replacing it -(\d{1,3})-with

-(7([0-689]\d?|7[0-689]?)?|3([02-9]\d?|1[0-46-9]?)?|[0-24-68-9]\d{0,2})-

sandbox.onlinephpfunctions.com/code/34e74b3e154b70...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question