首頁  >  問答  >  主體

Python正規表示式問題,(?i)什麼意思

filter(re.compile('(?i)([qwertyuiop]|[asdfghjkl]|[zxcvbnm]*)$').match, words)
如上,這是一個Python語句,(?i)什麼意思?

仅有的幸福仅有的幸福2690 天前2474

全部回覆(1)我來回復

  • 仅有的幸福

    仅有的幸福2017-05-18 11:02:09

    (?aiLmsux)
    (One or more letters from the set 'a', 'i', 'L', 'm', 's', 'u', 'x'.) The group matches the empty string; the letters set the corresponding flags: re.A (ASCII-only matching), re.I (ignore case)、re.L(區域設定相關)、re.M(多行)、re.S(點匹配所有)和re.X(詳細),用於整個正則表達式。(標誌是模組內容中描述。

    請注意, (?x) 標誌會改變表達式的解析方式。它應該首先在表達式字串中使用,或在一個或多個空白字元之後使用。如果標誌前有非空白字符,則結果未定義。

    忽略大小寫

    回覆
    0
  • 取消回覆