User:Xenwolf/Regex snippets: Difference between revisions
Jump to navigation
Jump to search
refined empty cell style, added space after metachar |
fixed space after meta, changed empty style to regex character class syntax |
||
Line 38: | Line 38: | ||
| consistent spacing for table cells (when rows are aligned vertically) | | consistent spacing for table cells (when rows are aligned vertically) | ||
|- | |- | ||
| <code><nowiki>^( | | <code><nowiki>^([!|]) \|</nowiki></code> | ||
| <code><nowiki>\1</nowiki></code> | | <code><nowiki>\1</nowiki></code> | ||
| remove empty style definitions for table cells | | remove empty style definitions for table cells | ||
Line 50: | Line 50: | ||
| remove inline CSS style of text alignment in table cells | | remove inline CSS style of text alignment in table cells | ||
|- | |- | ||
| <code><nowiki>^ | | <code><nowiki>^([!|])([^-+} ]+)</nowiki></code> | ||
| <code><nowiki>\1 \2</nowiki></code> | | <code><nowiki>\1 \2</nowiki></code> | ||
| add one space after cell metachar | | add one space after cell metachar |
Revision as of 12:53, 3 August 2020
These are regular expressions I use in Notepad++, they are also usable in Perl.
Pattern to Find | Replace by | Purpose |
---|---|---|
\|\s*([^|]+?)\s*>
|
{{Monzo| \1 }}
|
replace inline-monzos in tables #1 (cell definitions in same lines) |
<nowiki>\s*\|\s*([^<]+?)\s*</nowiki>>
|
{{Monzo| \1 }}
|
replace inline-monzos in tables #2 (cell definitions on separate lines) |
^\| \|
|
|
|
remove empty styling from table cells |
\[\[([\d/]+)\|\1\]\]
|
[[\1]]
|
simplify links to interval pages |
\[\[(\w[^|]+?)\|\1\]\]
|
[[\1]]
|
simplify internal links |
<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) |
^([!|]) \|
|
\1
|
remove empty style definitions for table cells |
\[\[([- \w]+)_
|
[[\1
|
iterative removal of redundant underscores |
style="text-align:\w+;" \|
|
|
remove inline CSS style of text alignment in table cells |
^([!|])([^-+} ]+)
|
\1 \2
|
add one space after cell metachar |
|
|
description |