3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

シンプルな例で学ぶ正規表現の「否定先読み」「肯定先読み」「否定後読み」「肯定後読み」

3
Posted at

@shotets 氏による記事を図的に整理して直感的に正規表現の先読み・後読みを把握する

実例を眺めながら覚える

image.png

  • 先読み/後読みを行う部分、すなわち(?)で囲まれた部分は、考慮されるが、選択されない
  • ! がつくと否定 (よくある)
  • < がつくと文字列の左側
    • 矢印のように覚えよう

名前と動作を対応付ける

先読みと後読みの「先」と「後」の対応がゴチャゴチャになるので、図的に整理しておきたい
image.png

どっちが先でどっちが後かをはっきりさせるために、歩く人をつけておいた。

3
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?