Regex on large array

91 Views Asked by At

I have a very large string in the form:

a1 + b1
a2 + b2
a3 + b3
.
.
.
an + bn

and I need to convert it to C array operations:

a[1]+b[1];
a[2]+a[2];
.
.
.
a[n]+b[n];

What regular expression are you suggesting and which tool? I was trying the regular expressions of jedit but I can switch if required.

Thanks a lot :)

1

There are 1 best solutions below

0
On BEST ANSWER

Using jEdit:

search for:

([a-z]+)([0-9]+)

replace with:

$1[$2]