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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login