Reputation: 647
I have a file which contains text like:
1x
2x
5x
10x
50x
100x
.....
Using Eclipse search and replace with regex, how do I script to have an output like
x1
x2
x5
x10
x50
x100
...
That is to say, search for a regex, break it into fields (\d+x, thus \d+ and 'x' in my case), and reuse the field elements later to resubstitute as 'x'+'\d+'.
I looked at a previous question on same lines, but I want to take that a step further.
Thank you.
Upvotes: 1
Views: 129
Reputation: 24350
Search for
(\d+)x
and replace with
x\1
And enable "Regular expressions". It will put the 'x' in front of the number.
Upvotes: 2
Reputation: 11126
search: (\d+)(.+)
replace with : \2\1
or $2$1
whichever eclipse supports
Upvotes: 1