Any match

2 snippets across 2 stacks — JavaScript, Regular Expressions

Also written as match any

JSJavaScript

includes(), some(), every()

JS · Arrays
syntax
arr.includes(value)
arr.some(callback)
arr.every(callback)
example
const perms = ["read", "write", "delete"];
console.log(perms.includes("write"));  // true

const ages = [22, 17, 30, 15];
console.log(ages.some(a => a < 18));   // true
console.log(ages.every(a => a >= 18)); // false

Note includes() uses strict equality (===) and works with NaN. some() short-circuits on the first true; every() short-circuits on the first false.

RXRegular Expressions

Dot (Any Character)

RX · Basic Patterns
syntax
.  (matches any single character except newline)
example
JS:  'bat bet bit'.match(/b.t/g)
Py:  re.findall(r'b.t', 'bat bet bit')
output
["bat", "bet", "bit"]

Note The dot does NOT match newline (\n) by default. Use the s (dotall) flag to make dot match newline as well. A common beginner mistake is using . when you mean a literal period -- escape it as \. instead.