in reply to
Some specific examples would help, e.g. a set of possible inputs and the desired output.
Do you need the position as the word number, or the character number?
Results (517 votes),