Jump to content

User:Audacity/Regex

From Wikipedia, the free encyclopedia
Useful regular expressions.

Use with User:Cacycle/editor, or your favorite text editor.

Find and replace song titles

[edit]

<Song> from <Album>

[edit]
Step 1

Find:

\) ([^*=]*?) (from [^*=]*?\n)

Replace:

) "$1" $2
Step 2

Find:

(\* \(.\:.{2}\)) ([^"\n*]*?)\n

Replace:

$1 "$2"\n
Check over
\* \(.\:.{2}\) [^"]

Artist - Song

[edit]
Fix multiple songs

Find:

(.*?)(,|\n)

Replace:

"$1"$2

Find:

\[\[(.*?)\]\](,|\n)

Replace:

"[[$1]]"$2

Fix headings

[edit]

Find:

(={2,5})([^ =]{1}.*?)={2,5}

Replace:

$1 $2 $1