例如,我想解析python文件與三重雙引號之間的文本,並從該文本生成html表。例如像正則表達式雙引號和換行符之間的提取
"""
Replaces greater than operator ('>') with 'NOT BETWEEN 0 AND #'
Replaces equals operator ('=') with 'BETWEEN # AND #'
Tested against:
* Microsoft SQL Server 2005
* MySQL 4, 5.0 and 5.5
* Oracle 10g
* PostgreSQL 8.3, 8.4, 9.0
Requirement:
* Microsoft Access
Notes:
* Useful to bypass weak and bespoke web application firewalls that
filter the greater than character
* The BETWEEN clause is SQL standard. Hence, this tamper script
should work against all (?) databases
>>> tamper('1 AND A > B--')
'1 AND A NOT BETWEEN 0 AND B--'
>>> tamper('1 AND A = B--')
'1 AND A BETWEEN B AND B--'
"""
HTML表格必須是簡單的表包含5列
- 柱一切
"""
和\n if new line is empty
之間 - 柱一切
Tested against:
和\n if new line is empty
或Requirement:
之間和文本塊
\n if new line is empty
- 柱一切
Notes:
和\n if new line is empty
- 柱之間的所有
>>>
和\n
- 之間柱一切
4 column end
和\n
之間,結果必然是:
- 替換大於運算符( '>' )'NOT BETWEEN 0 AND#' 用'BETWEEN#AND#'替換等於運算符('=')
-
的Microsoft SQL Server 2005
- 的MySQL 4,5.0和5.5
- 的Oracle 10g
- 的PostgreSQL 8.3,8.4,9.0
或
- Microsoft Access
-
- 有用繞過弱和定製的web應用程序的防火牆 過濾除字符
- 之間子句越大SQL標準。因此,這種篡改腳本 應反對各種(?)數據庫
篡改( '1個A> B--') 篡改( '1個A = B--')
「1和未介於0和B--」 「1和B之間和B--」
我可以使用什麼樣的語法來提取? 我將使用VBScript.RegExp。
Set fso = CreateObject("Scripting.FileSystemObject")
txt = fso.OpenTextFile("C:\path\to\your.py").ReadAll
Set re = New RegExp
re.Pattern = """([^""]*)"""
re.Global = True
For Each m In re.Execute(txt)
WScript.Echo m.SubMatches(0)
Next
非常感謝你 –
優秀的解釋。 – Lankymart