PDFregex を使用して PDF ドキュメントからインデックスを抽出し、DB の参照エントリとして機能させたいと考えています。インデックスは (予想されるように) すべて index という単語で始まりますが、(moslty0 ダブル キャリッジ リターンで終わります。どの正規表現を使用すればよいでしょうか?
1 に答える
0
これを試して:
Index(.|\s)*?(?=(?:\n\r|\n|\r){2})
# Index --> Find `Index`
# (.|\s)*? --> Followed by any string including linefeeds (? to make it not greedy)
# (?=(?:\n\r|\n|\r){2}) --> Stop at (the first) double linefeed:
# (?=) --> Positive lookahead: Matches if the previous is followed by it's contents.
# (?:) --> Non-capturing group.
# \n\r|\n|\r --> Linefeeds: Windows or LF or CR
# {2} --> Exactly 2 of the previous.
コード内で、ドットが.
改行と一致することを必ず指定してください。
于 2013-01-11T14:22:41.777 に答える