/foo bar/;
/foo/gimyus,
/[\[\]]{2,4}(?:foo)*/;
/foo"test"bar/;
/foo\//;
/[]/;
/[\]/]/;
1 / 4 + "/, not a regex";
/ '1' '2' '3' '4' '5' /
[/foo/]

let a = /regex/m // comment
let b = condition ? /regex/ : /another one/
return /regex/;
yield /regex/;

----------------------------------------------------

[
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "foo bar"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "foo"],
		["regex-delimiter", "/"],
		["regex-flags", "gimyus"]
	]],
	["punctuation", ","],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "[\\[\\]]{2,4}(?:foo)*"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "foo\"test\"bar"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "foo\\/"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "[]"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "[\\]/]"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["number", "1"],
	["operator", "/"],
	["number", "4"],
	["operator", "+"],
	["string", "\"/, not a regex\""],
	["punctuation", ";"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", " '1' '2' '3' '4' '5' "],
		["regex-delimiter", "/"]
	]],
	["punctuation", "["],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "foo"],
		["regex-delimiter", "/"]
	]],
	["punctuation", "]"],

	["keyword", "let"],
	" a ",
	["operator", "="],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "regex"],
		["regex-delimiter", "/"],
		["regex-flags", "m"]
	]],
	["comment", "// comment"],
	["keyword", "let"],
	" b ",
	["operator", "="],
	" condition ",
	["operator", "?"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "regex"],
		["regex-delimiter", "/"]
	]],
	["operator", ":"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "another one"],
		["regex-delimiter", "/"]
	]],
	["keyword", "return"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "regex"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"],
	["keyword", "yield"],
	["regex", [
		["regex-delimiter", "/"],
		["regex-source", "regex"],
		["regex-delimiter", "/"]
	]],
	["punctuation", ";"]
]

----------------------------------------------------

Checks for regex.