1 / 7

Compiler 助教課 Regular Expression

授課:呂明達. Compiler 助教課 Regular Expression. 大綱. 什麼是正規表達式 正規表達式符號及其意義 基本範例. 什麼是正規表達式. 什麼是正規表達式? 電腦中用來表達匹配符合句法規則的一個字串 又稱常規表達式或正規表示 為什麼需要? 方便字串搜尋或取代. 正規表達式符號及其 意義. 基本字彙: A-z,0-9 + 至少一次 * 零或多次 ? 零或一次 . 任意字 [] 集合 - 範圍 跳脫字元. 正規表達式符號及其 意義. ^ 以 … 為開頭的字串 $ 以 … 為結尾的字串 {n} 出現 n 次

Download Presentation

Compiler 助教課 Regular Expression

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 授課:呂明達 Compiler 助教課Regular Expression 製作及版權所有均屬呂明達

  2. 大綱 • 什麼是正規表達式 • 正規表達式符號及其意義 • 基本範例 製作及版權所有均屬呂明達

  3. 什麼是正規表達式 • 什麼是正規表達式? • 電腦中用來表達匹配符合句法規則的一個字串 • 又稱常規表達式或正規表示 • 為什麼需要? • 方便字串搜尋或取代 製作及版權所有均屬呂明達

  4. 正規表達式符號及其意義 • 基本字彙:A-z,0-9 • +至少一次 • *零或多次 • ?零或一次 • .任意字 • []集合 • -範圍 • \跳脫字元 製作及版權所有均屬呂明達

  5. 正規表達式符號及其意義 • ^以…為開頭的字串 • $以…為結尾的字串 • {n}出現n次 • {n,}至少出現n次 • {n,m}至少n次至多m次 • |或 • \d數字 • \D所有非數字 製作及版權所有均屬呂明達

  6. 正規表達式符號及其意義 • \w[A-Za-z0-9_] • \W非[A-Za-z0-9_] 製作及版權所有均屬呂明達

  7. 基本範例 • 表示任意正整數 • [1-9][0-9]*|[0-9] 製作及版權所有均屬呂明達

More Related