in reply to Swap the characters
Using regular expression? Presumably you mean using the substitution operator. Given how much this sounds like homework — -- for not disclosing — I'll just give you a tip: Use backreferences.
The substitution operator can only work on one string at a time. You'll have to use more than the substitution operator if you want to operator on multiple strings.Given any number of string only first and last character should be swaped
|
|---|