Answers for "regular rexpression except"

1

regular rexpression except

// Search everything but strings not include 'validate'
let reg = /^((?!validate).)*$/
let str = "https://yourdomain.com/validate"

// Search by charactor, exlcue all the chars in charachter_to_not_match
let reg = /[^charachter_to_not_match]*/
Posted by: Guest on January-11-2021
5

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"]
Posted by: Guest on April-06-2020

Browse Popular Code Answers by Language