Skip to content

Instantly share code, notes, and snippets.

@dilaouid
Created September 5, 2023 16:14
Show Gist options
  • Save dilaouid/b3edb459860fa8c79049eea0828e6f66 to your computer and use it in GitHub Desktop.
Save dilaouid/b3edb459860fa8c79049eea0828e6f66 to your computer and use it in GitHub Desktop.
regex for global XSS protection and bbCode check
const bbCodeMatch = /\[(b|i|u|s)\](.*?)\[\/\1\]/gs;
const XSSMatch = /[<]*<[\s\u200B]*script[\s\u200B]*>.*[/]*[<]*<[\s\u200B]*\/[\s\u200B]*script[\s\u200B]*>/ig;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment