Please could I ask for some advice on how to replace certain bits of my string variable, dependent on what follows a certain character?
E.g
String variable #1 = Pushin’ N Pullin’
String Variable #2 = Should’ve Been Me
For Pushin’ N Pullin’, I want it to replace the character ’ with nothing, simply remove it - because there is no character immediately after it. However, for Should’ve Been Me, I want to replace the character ’ with a space, because there is a character either side of it.
The rule I want to employ is: if there’s a character either side of a ’ then remove it and replace with a space, and if there is no character after a ’ then just remove it.
Does anyone know how best to write this using Regex?
Hi @william.coulson cheers for this - I’ve ended up using the solutions posted below, but thanks for this suggestion, will definitely bear it in mind for when I need to incorporate some IFs potentially further down the line. Thanks for your help!