I know that a regular expression can be used to write checkers that check pairs of start and end characters for brackets:
eg. a.[b.[cd]].e output values a , [b.[cd]] and e
How can I write a regex that can identify the start and end brackets that are the same character
eg. a.|b.|cd||.e will give the values a , |b.|cd|| and e
Update
Thanks for all the comments. I have to give some context to this issue. I basically want to simulate javascript syntax
a.hello is a["hello"] or a.hello a.|hello| is a[hello] a.|bc|de||.f.|g| is a[bc[de]].f[g]
So what I would like to do is split the characters into:
[`a`, `|bc|de||`, `f`, `|g|`]
and then repeat them if they are quoted
I have a pipeless syntax implementation here:
https://github.com/zcaudate/purnam
I really hope not to use the parser mainly, because I donβt know how and I donβt think it justifies the necessary complexity. But if the regex can't cut it, I might need to.
source share