也许这个问题很熟悉,但在这种情况下我需要一个解释。
假设我有一个名为test.txt
. 它有以下内容:
An example of this line. The line has more than 20 characters.
[sql]SELECT * FROM LINE WHERE aLine = '123'[/sql]
blah blah blah blah...
或者是关于什么的
An example of this line. The line has more than 20 characters.
[sql]SELECT * FROM
LINE
WHERE aLine = '123'[/sql]
blah blah blah blah...
[sql] SELECT * FROM ME[/sql]
etc..er
[sql]
SELECT * FROM ALL
[/sql]
我想在[sql]
和[/sql]
分隔符之间得到一个字符串。
怎么做 ?用正则表达式?
谢谢耐心...