Answer the question
In order to leave comments, you need to log in
Why does regex work like this?
var symbol = "s cchh'shchcz'' ";
console.log(symbol.split(/(sh|sch|ch|cz|yu|ya|yo|zh|''|'|.)/))
[
'', 's', '', ' ', '', 'c',
'', 'ch', '', 'h', '', "'",
'', 'sh', '', 'ch', '', 'cz',
'', "''", '', ' ', ''
]
Answer the question
In order to leave comments, you need to log in
Because you wrote it like this =)
/(sh|sch|ch|cz|yu|ya|yo|zh|''|'|.)/
^
// └ Сопоставляется с любым символом
/(sh|sch|ch|cz|yu|ya|yo|zh|''|')/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question