User:Audacity/Regex

From Wikipedia, the free encyclopedia

Useful regular expressions.

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

Contents

[edit] Find and replace song titles

[edit] <Song> from <Album>

Step 1

Find:

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

Replace:

) "$1" $2
Step 2

Find:

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

Replace:

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

[edit] Artist - Song

Fix multiple songs

Find:

(.*?)(,|\n)

Replace:

"$1"$2

Find:

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

Replace:

"[[$1]]"$2

[edit] Fix headings

Find:

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

Replace:

$1 $2 $1