有以下的特殊量詞,摘例於O'Reilly的正規式速查手冊:
例:The name "McDonald's" is said "makudonarudo" in Japanese.
找出被雙引號的括起來的字串:
若是使用/".*"/,它預設會找到最長符合的
The name "McDonald's" is said "makudonarudo" in Japanese.
若是使用/".*?"/,會找到最短符合的:
The name "McDonald's" is said "makudonarudo" in Japanese.
若是使用/".*+"/,找到底若不是雙引號結尾,會失敗,因為比對不到。而我使用Perl,則無法使用.*+,看各家作法。
The name "McDonald's" is said "makudonarudo" in Japanese.
 
arrow
arrow
    全站熱搜

    Jemmy 發表在 痞客邦 留言(0) 人氣()