Suppose there is an initial string abcdef in it to find the characters cd then invert the selection of these characters in the original string and as a result get the string abef or an array with elements that store the values ab and ef .

    1 answer 1

    As one of the possible options, invert the character class and search for all occurrences of this regular expression.

     /[^cd]+/ 
    • works, what you need, thank you - perfect