Regular expression
-
Hello friends, I was practicing with Regular expression and I want to delete some columns and I am using the following code
search for: ^([^ ]+?):([^ ]+?):([^ ]+?):([^ ]+?):([^ ]+?).*
And replace with: $1:$5Kenty:level57:Elite:Knight:edrty
Mawk:level69:Elder:Druid:12wer
Pog:level122:Elite:Knight:3edrt
Tygger:level34:Elder:Druid:eeeeand the result I get is
Kenty:e
Mawk:1
Pog:3
Tygger:eeverything works fine up to replace with $1:$4, but with the 5 column does not work something I’m doing wrong, I hope you help me solve it
-
@adelinefiu
You were very close. Just change the * for a +. The + is greedy and it will try to grab as many characters as possible up to the end of the line.Suggest read the FAQ, it has some good links. Also rexegg.com has a table outlining the meaning on the * and +.
Terry