I am allowing to make a new field in one of my web apps, to add a product.
Pushing add a product clones one of the inputs, and I set it to a blank value.
I need to update the name however. The name is in this format
<input type="text" name="product[0][0][3][title]" value="my product" id="input-AbGHtQS3" maxlength="150" />
I need to increment the last numerical index, that is the 3 in this example.
I wrote a regex to match the character, but I must be having a bad day, as I can't come up with something to increment that last number.
Here is my regex:
/^product\[\d+\]\[\d+\]\[(\d+)\]\[.+\]/
How could I increment that last number?