I have a string, with characters a-z, A-Z, 0-9, (, ), +, -, etc.
I want to find every word within that string and replace it with the same word with 'word' (single quotes added). Words in that string can be preceded/followed by “(“, “)”, and spaces.
How do I go about doing that?
Input:
(Movie + 2000)
Output:
('Movie' + '2000')
As stated in the comments, regex is a good way to go:
You don’t give a precise defition of ‘word’, so I assume it is any combination of letters and numbers.
EDIT OK, thanks to @Buhb for explaining why this solution is not the best one. Better solution was given by @Bohemian.