Skip to content

Instantly share code, notes, and snippets.

View Raja0sama's full-sized avatar
😍
CODING DAY NIGHT

Raja Osama Raja0sama

😍
CODING DAY NIGHT
View GitHub Profile
@Raja0sama
Raja0sama / Regex to Check if all Condition Exists
Created December 20, 2020 09:18
Match an Array of string from a string
MatchArrOnStrings = ({
arr: ['red', 'blue', 'green'],
string: 'We have a red and blue and green Thingies',
}) => {
const a = arr;
const b = string;
const reg = new RegExp(a.join('|'), 'g');
const c = b.match(reg);
return c.length == a.length;