1

I have a list of exclusion numbers.

for example (400276|400615|402914|404625)

the pattern should not let me enter into the input any of these numbers as the first 6 digits example

400276123 .BAD. because the value init with a number to exclude

400277123 .OK

I try something like that

"^[^] (400|405)"

but is not working

how can I use a pattern for exclude this first 6 digits

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Ivan Paredes
  • 465
  • 2
  • 5
  • 20

1 Answers1

1

Your pattern - ^[^] (400|405) - matches the start of the string, then any char, a space, and either 400 or 405.

What you need is a negative lookahead:

/^(?!400276|400615|402914|404625)/
  ^^^                           ^

It will fail the match of a string that starts with these values.

See the regex demo.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563