LoginSignup
2
2

More than 5 years have passed since last update.

動的な囲み文字を使ったパターンマッチ

Posted at

perlの qr{...}qr|...| のようなものを正規表現でマッチさせたいときのtips。
結論から言うと以下の正規表現を利用すればいい。

qr(.)(?:[^\1]|\\\1)*\1

(.) で囲み文字をキャプチャし、 \1 で利用している。
詳しくはperldoc perlreを参照。

2
2
0

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
2
2