Comrade:CriticalResist/sandbox: Difference between revisions

(library has been moved to live commit, see ProleWiki:Library.)
Tag: Blanking
No edit summary
Tag: Visual edit
Line 1: Line 1:
== Some useful regex functions ==
You can use search and replace with regex in the visual editor, just tap ''Ctrl+f'' on your keyboard, then click on the icon representing <code>(.*)</code> -- that's the regex (regular expression) function, which will interpret your search string as regex.


Unfortunately you can't use regex in the replace function but anyway, here are some cool regex functions you can use to help you on pages. Just copy the "regex code" row into the search bar (yes it looks like nothing, that's normal)
{| class="wikitable"
|+
!Regex code
!What it does
!Use for
|-
|<code>\[(\d+)\]</code>
|Detects references like <sup>[12]</sup>
|Transform plain text references into formatted MediaWiki references (ctrl+shift+k to add a reference)
|-
| <code>{2,}</code>
|Detect two spaces or more
|Replace with " " (single space) and press replace all. Note the space preceding {.
|-
|
|
|
|}

Revision as of 15:43, 8 July 2023

Some useful regex functions

You can use search and replace with regex in the visual editor, just tap Ctrl+f on your keyboard, then click on the icon representing (.*) -- that's the regex (regular expression) function, which will interpret your search string as regex.

Unfortunately you can't use regex in the replace function but anyway, here are some cool regex functions you can use to help you on pages. Just copy the "regex code" row into the search bar (yes it looks like nothing, that's normal)

Regex code What it does Use for
\[(\d+)\] Detects references like [12] Transform plain text references into formatted MediaWiki references (ctrl+shift+k to add a reference)
{2,} Detect two spaces or more Replace with " " (single space) and press replace all. Note the space preceding {.