Rather than coming back every few minutes with yet another request for a personally handcrafted button, you might like to investigate the sections give over to just these functions:
I mention this because I also wanted to work out some slightly strange things, and, apart from not wanting to impose on people too much, I concluded that it would be quicker to spend a little time learning the principles so that I could roll my own.
The thing to look for is a script that is near as dammit to what you want to achieve. Then experiment. There are already some there that do what you have asked for. Unfortunately, they don't always come with the step-by-step documentation that would make it easier for a genuine dunce like me to understand them, but you get the hang eventually.
You may also find that a search of this place will throw up useful tips.
Of course, if you end up in "Regex" territory, that is another matter. That particular domain is beyond my feeble and fading brain power, so I would probably have to turn to the experts, who seem to do this stuff in their sleep.