[SOLVED]
Solution =
=================
The main focus/goal here is what RegEx is needed to match inside the brackets (ie. an Array). I intend to make a D&D-like system, and want to do something like this:
But will add in the type later (WEAPON || ARMOR || TOOLS) etc. Right now though, how do I read an array of numbers and return the entire array as 1 "Group"?
Solution =
JavaScript:
const tag = /<PROF:\s\[([\d+,]+)\]>/i;
// test: <prof: [1,2,3]>
// returns:
"Group #1: 1,2,3"
=================
The main focus/goal here is what RegEx is needed to match inside the brackets (ie. an Array). I intend to make a D&D-like system, and want to do something like this:
JavaScript:
// Inteded notetag: <prof: [1,2,3]>
// current RegEx (UPDATED):
const tag = /<PROF:[ ]\[(\d+)(?:,[ ])*\]>/i;
// Doing it this way, returns 2 incorrect groupings:
const tag = /<PROF:[ ]\[((\d+)(?:,[ ])*)+\]>/i;
// This way returns 1 grouping, but only the last digit
const tag = /<PROF:[ ]\[(?:(\d+)(?:,[ ])*)+\]>/i;
But will add in the type later (WEAPON || ARMOR || TOOLS) etc. Right now though, how do I read an array of numbers and return the entire array as 1 "Group"?