Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8714837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:41:49+00:00 2026-06-13T05:41:49+00:00

So, i have html file with a line like: <script data-cfasync=false type=text/javascript> fid=RandonString; v_width=620;

  • 0

So, i have html file with a line like:

<script data-cfasync="false" type="text/javascript"> fid="RandonString"; v_width=620; v_height=490;</script>

My task is to find fid=”RandomString” and copy everything between “” to a text file without using any external software.
RandonString is 2-100 characters long.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:41:50+00:00Added an answer on June 13, 2026 at 5:41 am

    It’s not all that hard, here’s a 5 line solution:

    set "x=<script data-cfasync="false" type="text/javascript"> fid="RandonString"; v_width=620; v_height=490;</script>"
    set "x=%x:*fid=%"
    set "x=%x:";="&rem %
    set  x=%x:~2%
    echo %x%
    

    An explanation of what is going on.

    You have to deal with 5 special characters, the <, >, =, " in your string, and the & character used to trim trailing data.

    Lines 1-3: <> are both redirection characters, so to deal with them, it’s required that the whole variable be surrounded by doublequotes ("). BUT you don’t want the double quotes to be added to the variable itself.

    Line 1 By putting the first quote before the variable to be set ( “x=), and the second one after the data to be set (<script data-cfasync="false" type="text/javascript"> fid="RandonString"; v_width=620; v_height=490;</script>” ), the command SET recognises that the quotes are not to be included in the variable. Thus variable data with special characters can be set without errors. (Putting the quotes inside the variable data will work too, but adds 2 special characters to the variable data and makes dealing with other search & replace commands more difficult.)

    Line 2 The next step is to remove everything up to and including fid, *fid matches everything up to fid, the =% replaces it with nothing.

    Line 3 The next step is to to remove everything after ";, this requires a little hack. The command processor can be tricked into doing this by adding ="&rem % to the search and replace. The ‘=’ tells the command processor to replace ;" with the following characters, but the next character is ", which makes the preceding set command a quoted command, and means that the special & character is not quoted, leaving it available to be interpreted. This essentially puts everything after the & on a separate line, and so the search and replace command replaces "; with nothing. The REM statement is there to make sure the data that comes after the matched "; is not interpreted as a command and also means that any redirection characters will be ignored.

    So what the command processor sees is:

    set x=="RandonString
    rem "; v_width=620; v_height=490;</script>
    

    Which sets x to ="RandonString

    Line 4 Now we have a problem since %x% begins with =", and both = and " are special characters, with = being especially hard to match. But, luckily we know that the string now starts with =", so the solution is simple. We simply skip the first two characters by telling the command processor to start with the 2nd character (character 0 currently = =, character 1 currently = ", so character 2 = R). Therefore, since Line 2 removed everything (including any redirection characters) up to and including fid, and Line 3 removed everything including "; to the end of the string (including any redirection characters),
    %x:~2% = RandonString. With all the redirection characters removed, the variable does not need to be quoted at all.

    Line 5 Just echo’s the variable x.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some javascript that is embedded in the html file like this <html>
I have a PHP script that dynamically creates a HTML file. In command line,
I currently have a huge HTML file which doesn't have line breaks and just
I have html-file. I have to replace all text between this: [%anytext%]. As I
I have a html file like following: <form action=/2811457/follow?gsid=3_5bce9b871484d3af90c89f37 method=post> <div> <a href=/2811457/follow?page=2&amp;gsid=3_5bce9b871484d3af90c89f37>next_page</a> &nbsp;<input
I have an HTML file and i would like to parse through it using
i have a script like this : <html> <body> <?php require("wrongFile.php"); echo "Hello World!";
Here is my program import subprocess print Content-type:text/html\r\n\r\n print File starting to execute print
I have text file. there around 1000 lines in it, each line contains a
I have a script which generates like 16000 html pages and saves it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.