c# - How to select the comma in multidimensional array? -
i have been developing application quite long time now, started using rectangular array:
int[,] array = new int[900,800]
but after giving higher values turned out caused lot of outofmemoryexception problems, decided replace multidimensional array this:
int[][] array /*init stuff*/
but after doing compiler gave me 3000 errors (obviously), require lot of time fix manually, started thinking regular expressions replace ',' ']['. want select , inside array square brackets. far got:
(?<=array\[).*,
which selects ',' right, selects rest of index like:
array[aaa,bbb] ^^^^ array[bbbb,ccc] ^^^^^
is there way select ',' like:
array[aaa,bbb] ^
note: doesn't have 100% perfect, want work in of cases. thanks.
you can use expression:
\[([0-9]+),\s*([0-9]+)\]
and replace with:
[$1][$2]
this expression matches less current attempt, result in less error-prone matching.
Comments
Post a Comment