Good day. Help make RegExp for Cyrillic.

You must find certain characters in the string.

I tried it, it does not work correctly

/[ГОАОДРАЗНЯ]/ui 

That is, there is the word country and the regular must spell it.

Thank.

  • /[ГОАОДРАЗНЯ]+/ui ? - Yuri
  • @yuri, So it does not work either. - dakemu
  • Do you have a word in which register is written? - Yuri
  • In uppercase. It is necessary for me that the word be ONLY these characters G O A D D A T I O. - dakemu
  • The idea should work. Are you sure you are doing the right thing? - Yuri

1 answer 1

 /\b[ГОДРАЗНЯ]+\b/ 

\b - means word boundary, i.e. The regular page will search for words consisting only of letters listed in square brackets.

2 times to write О in brackets is not necessary. Also the words ГРАД , ГОРОД , etc.

If you don’t add \b , it will scan everything where there is at least one letter from the list.