Regex not working as expected.

A swapping-ground for Regular Expression syntax

Regex not working as expected.

Postby Freshiethegeek » Sun May 12, 2019 7:51 pm

Code: Select all

Code: Select all
(there is a space after the 1)
Should replace the third underscore in a filename with a space, but it's not.
It's just removing everything behind the space created.
Here: it works as expected.
What might I be doing wrong?
Posts: 1
Joined: Sun May 12, 2019 7:48 pm

Re: Regex not working as expected.

Postby therube » Mon May 13, 2019 1:39 pm

Code: Select all
Could you post some actual before/after filenames.

Oh, never mind, they're in the link.

You need to specifically tell BRU to pick up the remaining parts of the name.
Code: Select all
Match:  ^(.*?_.*?_.*?)_(.*)
Replace:  \1 \2

(I've added a few extra spaces in there.)
Code: Select all
00-alice_cooper-theatre_of_death-live_in_wacken_2010.m3u   |   00-alice_cooper-theatre_of    death-live_in_wacken_2010m3u
00-afroman-a_colt_45_christmas-2006.m3u   |   00-afroman-a_colt_45    christmas-2006.m3u
00-adam_green_-_minor_love-2010.m3u   |   00-adam_green_-    minor_love-2010.m3u

Posts: 521
Joined: Mon Jan 18, 2016 6:23 pm

Return to Regular Expressions