regex all characters except code example
Example 1: regex match everything except
let reg = /[^charachter_to_not_match]*/
// Example
let str = '<<1,2,3>, <4,5,6>, <7,8,9>>'
//match everything but '>'
reg = /[^>]+/g // Array(3) ["<<1,2,3", ", <4,5,6", ", <7,8,9"]
//match everything but '<' and '>'
reg = /[^<>]+/g // Array(5) ["1,2,3", ", ", "4,5,6", ", ", ...]
//match anything but '<', '>', ',' and '\s' (\s=any whitespace)
reg = /[^<>,\s]+/g // Array (9) ["1", "2", ..., "9"]
Example 2: regex any char except
// to exclude "
[^"]
Example 3: regex exclude character
[^a] #any character except 'a'
[^aA] #any character except 'a' or 'A'
[^a-z] #any character except a lower case character
[^.] #any character not a period