Just checked them all out, it works great. I tried to play with “delete to” and was wondering, if it’s also possible to delete up to a certain character instead of a character count.
Something like
text: " abcdef" -> delete to “d” -> output: “ef”
just typing in the text or a variable didn’t do the trick
Thanks Chris for your fast response! It works great! Is there any documentation about what exactly is going on?
^.*d(x+) and $1 is pretty mysterious to me.
Besides “d” in ^.*d(x+) which seems to be the last one that gets deleted I have no idea what the rest means. What for example, if you want to do the same, but from the back of the string?
Sure. A couple of hundred books on regular expressions.
^.*d(.+)
^ == Beginning of line
. == Any character
* == Zero or more of the previous token
d == A literal character “d”
( == Start Capture-Group
. == Any character
+ == 1 or more of the previous token
) == End Capture group.
$1 == Represents the 1st (and only) Capture-Group
So I'm finding any characters from the beginning of the string until “d”, and I'm capturing the rest.