You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>If you have <a href="https://joeyh.name/code/moreutils/">moreutils installed</a>, then you could use <code>sponge</code> as well.</p>
<h2 id="rust-regex-and-pcre2">Rust regex and PCRE2<a class="zola-anchor" href="#rust-regex-and-pcre2" aria-label="Anchor link for: rust-regex-and-pcre2">🔗</a></h2>
72
76
<p>By default, <code>rg</code> uses Rust regular expressions, which is much more featured compared to <code>GNU sed</code>. The main feature not supported is backreference within regexp definition (for performance reasons). See <a href="https://docs.rs/regex/1.3.9/regex/index.html">Rust regex documentation</a> for regular expression syntax and features. <code>rg</code> supports Unicode by default.</p>
@@ -107,6 +111,15 @@ $ </span><span style="color:#7f8989;"># all lowercase
<h2 id="extract-and-modify">Extract and modify<a class="zola-anchor" href="#extract-and-modify" aria-label="Anchor link for: extract-and-modify">🔗</a></h2>
115
+
<p>The <code>-r</code> option can be used when <code>-o</code> option is active too. The example shown below is not easy to do with <code>sed</code>.</p>
<h2 id="fixed-string-matching">Fixed string matching<a class="zola-anchor" href="#fixed-string-matching" aria-label="Anchor link for: fixed-string-matching">🔗</a></h2>
111
124
<p>Like <code>grep</code>, the <code>-F</code> option will allow fixed strings to be matched, a handy option that I feel every search and replace tool should provide.</p>
<p><code>-F</code> doesn't extend to replacement section though, so you need <code>$$</code> instead of <code>$</code> character to represent it literally.</p>
<h2id="rust-regex-and-pcre2">Rust regex and PCRE2<aclass="zola-anchor" href="#rust-regex-and-pcre2" aria-label="Anchor link for: rust-regex-and-pcre2">🔗</a></h2>
238
247
<p>By default, <code>rg</code> uses Rust regular expressions, which is much more featured compared to <code>GNU sed</code>. The main feature not supported is backreference within regexp definition (for performance reasons). See <ahref="https://docs.rs/regex/1.3.9/regex/index.html">Rust regex documentation</a> for regular expression syntax and features. <code>rg</code> supports Unicode by default.</p>
<h2id="extract-and-modify">Extract and modify<aclass="zola-anchor" href="#extract-and-modify" aria-label="Anchor link for: extract-and-modify">🔗</a></h2>
286
+
<p>The <code>-r</code> option can be used when <code>-o</code> option is active too. The example shown below is not easy to do with <code>sed</code>.</p>
<h2id="fixed-string-matching">Fixed string matching<aclass="zola-anchor" href="#fixed-string-matching" aria-label="Anchor link for: fixed-string-matching">🔗</a></h2>
277
295
<p>Like <code>grep</code>, the <code>-F</code> option will allow fixed strings to be matched, a handy option that I feel every search and replace tool should provide.</p>
<p><code>-F</code> doesn't extend to replacement section though, so you need <code>$$</code> instead of <code>$</code> character to represent it literally.</p>
0 commit comments