Regex group in JavaScript -


i find words in string. example: {add_first} and/or {ban_1}

regular expression first: var arr = str.match(/{add_([a-z]+)}/gi);

regular expression second: var arr = str.match(/{ban_([0-9]+)}/gi);

but how combime both regular expressions?

/{(add_([a-z]+)|ban_([0-9]+))}/gi 

here regexper visualisation:

enter image description here


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -