2

署名の例は次のとおりです。

On Tue, Mar 20, 2012 at 2:38 PM, Johnny Walker <johnny.talker@gmail.com> wrote:

そして、引用された返信に従います。私はこれがロケール固有のものであるという個別の感覚を持っていますが、それが私を悲しいプログラマーにしています。

これをお願いする理由は、 Gmail で問題に返信するときに、ラウンドアップがこれらを正しく削除しないためです。そして、これを修正するorigmsg_reために横に設定する必要がある config.ini 変数だと思います。keep_quoted_text = no

今のところデフォルトですorigmsg_re = ^[>|\s]*-----\s?Original Message\s?-----$

編集:現在origmsg_re = ^On[^<]+<.+@.+>[ \n]wrote:[\n]、長すぎる行を分割する一部のgmailクライアントで動作するものを使用しています。

4

1 に答える 1

1

次の正規表現は、かなり安全な方法で gmail のプレフィックスに一致します。3 つのコンマとリッター テキスト On ... が書かれていることを確認します。

On([^,]+,){3}.*?wrote:

正規表現が大文字と小文字を区別しない方法で一致する必要がある場合は、修飾子を追加することを忘れないでください。

if re.search("On([^,]+,){3}.*?wrote:", subject, re.IGNORECASE):
    # Successful match
else:
    # Match attempt failed

敬具、バックリー

Match the characters “On” literally «On»
Match the regular expression below and capture its match into backreference number 1 «([^,]+,){3}»
   Exactly 3 times «{3}»
   Note: You repeated the capturing group itself.  The group will capture only the last iteration.  Put a capturing group around the repeated group to capture all iterations. «{3}»
   Match any character that is NOT a “,” «[^,]+»
      Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
   Match the character “,” literally «,»
Match any single character that is not a line break character «.*?»
   Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the characters “wrote:” literally «wrote:»

Created with RegexBuddy
于 2012-03-20T13:55:55.900 に答える