📜  正则 rexpression except - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:51.689000             🧑  作者: Mango

代码示例2
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"]