(Python)正規表現

Pocket

正規表現とは、Pythonのみならず、ほかの言語(Java,C,PHP,Javascript)などにも出てくる概念です。
この正規表現はある特定の文字列(パターン)が、検索対象の文字列に出現するかどうかを判定します。
検索パターンが検索対象の一部だけでも一致すればOKである。

(実行結果)

*******
(Pattern)Hello(search)GoodNight(match)NG
(Pattern)Hello(search)Tokyo(match)NG
(Pattern)Hello(search)Tokyoto(match)NG
(Pattern)Hello(search)car(match)NG
(Pattern)Hello(search)mycardrive(match)NG
(Pattern)Hello(search)mycar(match)NG
(Pattern)Hello(search)book(match)NG
(Pattern)Hello(search)building(match)NG
(Pattern)Hello(search)pencil(match)NG
*******
(Pattern)Tokyo(search)GoodNight(match)NG
(Pattern)Tokyo(search)Tokyo(match)OK
(Pattern)Tokyo(search)Tokyoto(match)OK
(Pattern)Tokyo(search)car(match)NG
(Pattern)Tokyo(search)mycardrive(match)NG
(Pattern)Tokyo(search)mycar(match)NG
(Pattern)Tokyo(search)book(match)NG
(Pattern)Tokyo(search)building(match)NG
(Pattern)Tokyo(search)pencil(match)NG
*******
(Pattern)car(search)GoodNight(match)NG
(Pattern)car(search)Tokyo(match)NG
(Pattern)car(search)Tokyoto(match)NG
(Pattern)car(search)car(match)OK
(Pattern)car(search)mycardrive(match)OK
(Pattern)car(search)mycar(match)OK
(Pattern)car(search)book(match)NG
(Pattern)car(search)building(match)NG
(Pattern)car(search)pencil(match)NG

ブックマーク へのパーマリンク.

コメントは停止中です。