mardi 7 août 2018

Delete portion of string from variable including and after pattern with batch file

Is this possible?

For example, let's say I have a variable containing the following string:

str=This is a test - because it can be

What I need to do is be able to search for and delete everything including and after the "space, dash, space", from the %str% variable. So, I would end up with:

str=This is a test

I can easily perform this action on a single character, deleting or replacing said single character, but can't figure out how to do so with a pattern.

Thanx in advance.

Aucun commentaire:

Enregistrer un commentaire