How to use the union function from xregexp

Find comprehensive JavaScript xregexp.union code examples handpicked from public code repositorys.

68
69
70
71
72
73
74
75
76
77
]);
console.log(result); // -> ['xregexp.com', 'www.google.com']

// Merge strings and regexes into a single pattern with updated backreferences
// http://xregexp.com/api/#union
var merge = XRegExp.union(['a+b*c', /(dog)\1/, /(cat)\1/], 'i');
// Patterns can be provided as regex objects or strings. 
// Metacharacters are escaped in patterns provided as strings.
// Backreferences in provided regex objects are automatically renumbered 
// to work correctly within the larger combined pattern. 
fork icon1
star icon0
watch icon2