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:
Comments
Post a Comment