Whatever string is given I have to see if there is exactly one space after and before =, If it is more than one space in either side I have to reduce that to one and if there is none, I have to insert one.
How should I do that ? String can contain anything.
Thanks
You can do this:
This will replace all
=characters regardless of how many spaces it is surrounded by. The*quantifier will match as most spaces as possible while allowing even no spaces at all.