user2257268
user2257268

Reputation: 5

In batch file, how to use regex to find last word in a line

str = "The is the end of line" how to search for the last word "line" in the above string fusing batch script.

Upvotes: 0

Views: 1806

Answers (1)

Endoro
Endoro

Reputation: 37569

Try this:

@echo off &setlocal
for %%i in (The is the end of line) do set "TheEnd=%%i"
echo(%TheEnd%

Upvotes: 1

Related Questions