Find the first data string in the row

Time:2021-1-14
Copy codeThe code is as follows:
@echo off
:: find the record in the form of < input name = ID value = 1842 type = hidden >
:: the first digit string of
: by detecting the type of each character to get, but the efficiency is very low
:: code by jm 2006-10-16 [email protected]
set num=0
setlocal enabledelayedexpansion
for /f “delims=” %%i in (input.txt) do call :intercept “%%i”
echo value=%str_%
pause
goto :eof
:intercept
set str=%1
set str=%str:~2,-2%
if not “%str%”==”” echo. “%str:~0,1%”|findstr “[0-9]”>nul && (
set num=1&set str_=!str_!%str:~0,1%&&call :intercept ” !str:~1! “)||(
if %num% equ 0 call :intercept ” !str:~1! ”
)
goto :eof
No alternative scheme, does not rely on the character before and after the relationship, will get any value after value = very fast
It can handle more data, such as input type = hidden name = ID value = 465974855 < input type = hidden name = ID value = 1820988170 > < input type = hidden name = ID value = 1008964101 >
String of
@echo off
setlocal enabledelayedexpansion
FOR /f “delims=” %%i in (input.txt) do (
set “t=%%i”
set “t=!t:<= !”
set “t=!t:>= !”
set “t=!t:&= !”
set “t=!t:|= !”
call :sub !t !
)
pause
goto :eof
:sub
if “%1” == “” exit /b
if “%F%” == “1” echo %1 &set F=0
if “%1” == “value” set F=1
shift
goto sub

Recommended Today

Simple implementation of recoil’s state subscription sharing

Recoil is a new react state management library, which is still in the experimental stage. It proposes decentralized atomic state management, provides hooks API for setting and obtaining state, and makes components subscribe to state. This paper simply implements the principle of making multiple components share and subscribe to a state in recoil. my-recoil (v1.0) […]