MZ Small Help With RegEx Please

[SOLVED]

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"?
Code:
/<PROF:[\s]*(\[(?:\d+,? *)+\])>/i
I think.
I grabbed this from my code, but I was grabbing an RGB, so it was a {3} not a + at the end.
back reference with $1, to grab the whole set within the outer [], included.
since it has the ,? that should scan for single values as well, because the one value doesn't have a , after them.
Code:
/<PROF:[\s]*(\[(?:\d+,? *)+\])>/i
I think.
I grabbed this from my code, but I was grabbing an RGB, so it was a {3} not a + at the end.
back reference with $1, to grab the whole set within the outer [], included.
since it has the ,? that should scan for single values as well, because the one value doesn't have a , after them.
Thanks, but I think I got it now (was fiddling some more) and this works for me! 😀

JavaScript:
const tag = /<PROF:\s\[([\d+,]+)\]>/i;
// test: <prof: [1,2,3]>
// returns:
"Group #1: 1,2,3"

I guess I should've been a little more patient! lol but thanks for replying anyways <3

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/small-help-with-regex-please.137297/