I have a string for example:
var string = 'This is a test sentence. Switch the characters. i .';
I want to switch position of every occurrence of the letter 'i' with the character following it except if the following character is a 't' or a non character like 'spaces' or 'line breaks'. So the result output should be some thing like:
Thsi si a test sentence. Switch the characters. i . // switches 's' but not 't' and 'space'
Is such a task possible with regular expressions? The characters I am working with are unicode characters. 'i' is just for an example. Which means matching all characters isn't a good idea. May be a not expression? I have tried some looping replaces but these aren't elegant (or efficient). Any ideas?
