1

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.

Community
  • 1
  • 1
Bleamer
  • 637
  • 9
  • 24

2 Answers2

2

Search for

(\d+)x

and replace with

x\1

And enable "Regular expressions". It will put the 'x' in front of the number.

enter image description here

Baldrick
  • 23,882
  • 6
  • 74
  • 79
1

search: (\d+)(.+)

replace with : \2\1

or $2$1 whichever eclipse supports

aelor
  • 10,892
  • 3
  • 32
  • 48