javascript - MongoDB regex does not match string between 2 pipes -


so want regex match type of elements, regex created in javascript.

i assume in mongo need \\ escape instead of one

element: toto|titi|tata|tete

  • if value tete or titi or tata or tete return false

  • if value to or ze or we return true

  • toto|titi value not matter because have regex removing specials characters value (it become tototiti)

atm used "(^|\|)" + value + "(\||$)" opposite - when value tete or titi or tata or tete return true

  • when value to or ze or we return false

i tried

  • "(^|\|)(?!" + value + ")(\||$)" didn't work

  • "(^|\|)(?!" + value + ").*(\||$)" didn't work

i have no more idea, have 1 ?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -