I want to parse a table line using regex.
Input
|---|---|---|
|---|---|---|
So far I've come up with this regex:
/^(?<indent>\s*)\|(?<cell>-+|)/g
Regex101 Link: https://regex101.com/r/wzMYxd/1
But this regex is incomplete.
This only finds the first cell --|
, but I want to find all the following cells as different ----|
.
Question: Can we catch the following cells with the same pattern using the regex? ExpectedOutput: groups with array of matched cells: ["---|", "----|", "---|"]
Note: no constant number of -
is required