Regular Expressions 101

Community Patterns

1...34567...901

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
((?s)(\[)(\d)(\])([ ])(?=.*:LOOKUP\3=(\w+))|(\[(\d+)\])[ ])((?<artist1>Frank Sinatra)?(\s-\s)(?<title1>.*)(?<ext1>\..*)|(?<title2>.*)(\s-\s)(?<artist2>Frank Sinatra)(?<ext2>\..*)|(?<title3>.*)(?<ext3>\..*))|(?<dict>RegExDictionary:.*)$
/
gmi

Description

Remove square brackets from Track number and optionally remove Artist Name from Title.

Submitted by António Cruz - 3 years ago