Clean string from "quote" and 'apostrophe'

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
darioit
Posts: 230
Joined: 02 Aug 2010 05:25

Clean string from "quote" and 'apostrophe'

#1 Post by darioit » 03 Oct 2016 03:51

Hello,

how can I clean this string from
html += "src='https://text1.com/text2/text3-text4/text5.txt'";


to
https://text1.com/text2/text3-text4/text5.txt


Thank in advance

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Clean string from Bracket

#2 Post by aGerman » 03 Oct 2016 04:00

It's enclosed into surrounding apostrophes. Thus, you could simply use them as delimiters in a FOR /F loop.

Code: Select all

set "string=html += "src='https://text1.com/text2/text3-text4/text5.txt'";"
for /f "tokens=2 delims='" %%i in ("%string%") do set "link=%%i"
echo %link%


Steffen

darioit
Posts: 230
Joined: 02 Aug 2010 05:25

Re: Clean string from "quote" and 'apostrophe'

#3 Post by darioit » 03 Oct 2016 04:09

Thank you very much, it's works fine !!

Best

Post Reply