Multiline matches with ripgrep (rg)

You can simply click the title of this blog to check the reference.

The key is the dotall modifier (?s). It helped out me today! by the way, my final match expression is

rg --pcre2 -U '(?s)\.Initialise\([^,]+,\s*([^,]+),\s*\1(?:,true|false)?\);'

rg is a so fast and so powerful tool in my daily use, I love it!

Reference

Comments

  1. David Wei said:

    There is a lot of useful information in that site, feel free to subscribe their rss address in your favorite RssReader, their rss address is https://til.hashrocket.com/rss

  2. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.