Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-01-28 16:07
Flavor·PCRE (Legacy)

/
(\[[^\]]+\]),?
/
g
Open regex in editor

Description

If you have "[[2,3],[4,5]]" representing a matrix, you can't just Split(',') because that'll give you "[[2" "3]" "[4" "5]]". Removing the first '[' and last ']' and using this regex will give you the elements "[2,3]" "[4,5]".

Cheers

Submitted by M.G.