Saturday, 14 September 2013

Regex how to move all matched char to the end of string

Regex how to move all matched char to the end of string

I want to move all matched char in a string to the end of it.
For example:
chafo -> chaof
sasc -> sacs
chafof -> chaoff
I tried with this:
Pattern: "/(.+)([f|z|x|r|s])+(.*)/"
Replacement: "$1$3$2"
But it just make: chafo -> chaof, not chafof -> chaoff
Can anyone help me out?

No comments:

Post a Comment