User:Xenwolf/Regex snippets: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Xenwolf (talk | contribs)
heading shifting
Xenwolf (talk | contribs)
+1
Line 22: Line 22:
| simplify superscript for exponents
| simplify superscript for exponents
|-
|-
| <code><nowiki>^(=+)\s*(.+)\s*(\1)$</nowiki></code>
| <code><nowiki>^(=+)\s*(.+)\s*(\1) *$</nowiki></code>
| <code><nowiki>\1= \2 \1=</nowiki></code>
| <code><nowiki>\1= \2 \1=</nowiki></code>
| downgrade heading structure from (h1, h2, h3, ...) to (h2, h3, h4, ...)
| downgrade heading structure from (h1, h2, h3, ...) to (h2, h3, h4, ...)
|-
| <code><nowiki>^\|([^\s{}-])</nowiki></code>
| <code><nowiki>| \1</nowiki></code>
| consistent spacing for table cells (when rows are aligned vertically)
|-
|-
| <code><nowiki></nowiki></code>
| <code><nowiki></nowiki></code>

Revision as of 23:34, 30 May 2020

These are regular expressions I use in Notepad++, they are also usable in Perl.

Pattern to Find Replace by Purpose
\|\s*([^|]+?)\s*&gt; {{Monzo|\1}} replace inline-monzos in tables
^\| \| | remove empty styling from table cells
\[\[([\d/]+)\|\1\]\] [[\1]] simplify links to interval pages
<span style="font-size: 70%; vertical-align: super;">(\d+)</span> <sup>\1</sup> simplify superscript for exponents
^(=+)\s*(.+)\s*(\1) *$ \1= \2 \1= downgrade heading structure from (h1, h2, h3, ...) to (h2, h3, h4, ...)
^\|([^\s{}-]) | \1 consistent spacing for table cells (when rows are aligned vertically)