Help with a Regex expression and a macro?

General discussion related to "Everything".
gggirlgeek
Posts: 56
Joined: Tue Dec 28, 2010 4:54 pm

Help with a Regex expression and a macro?

Post by gggirlgeek »

Hi,

I am pretty RegEx-stupid. I'm trying to find a quick way to remove the dots, and mabye the suffix-text from similar foldernames on a regular basis. I ran across two preprocessor functions that seem to do the trick, but I have a couple of questions, and I need help refining the RegEx. I tried a few variations but no success.

I'm using your example:
/[regex-replace:[regex-replace:$newtext:,"[`~!@#$%^&*()\-=_+{}|\[\]\\;':,./<>?\x22]"," "]," +"," "]
My Text:
My.TV.Show.S01E02.1080p.HEVC.x265-TheDude[YATVx.ts]
Result I want:
My TV Show S01E02 1080p HEVC x265-TheDude
The Suffix text is always the exact same, with brackets (and the.ts is not a file extenion.): [YATV.ts]
I want the foldername with spaces in place of dots, without quotes, and without the suffix-text.

What I get from the RegEx above:
"My TV Show S01E02 1080p HEVC x265 TheDude YATVx ts "," +"," "]

Second question:
Should I use the clipboard: function in combination with this command to quickly transform these folder names when I need to? Or should I create a Filter or Bookmark and simply paste my text in? Maybe I can substitute clipboard: in place of $newtext: in a Filter)? I guess this would be a macro? Or is there a better way?

Thanks in advance!
gggirlgeek
Posts: 56
Joined: Tue Dec 28, 2010 4:54 pm

Re: Help with a Regex expression and a macro?

Post by gggirlgeek »

I just found the Right-click>>Paste without Punctuation menu-item in the searchbar. For some reason it works better than the /[remove-punctuation: command on my particular text. So that's a pretty easy and fast way to clean up my folder name, but it doesn't clean up the suffix-text. I can live with that, though, if necessary. My result:
My TV Show S01E02 1080p HEVC x265 TheDude YATVx ts
void
Developer
Posts: 20314
Joined: Fri Oct 16, 2009 11:31 pm

Re: Help with a Regex expression and a macro?

Post by void »

Please try the following Tools -> Options -> Advanced -> search_edit_paste_format

<regex-replace:<regex-replace:<regex-replace:$newtext:,"\[.+\]$">,"[`~!@#$%^&*()\-=_+{}|\[\]\\;':,./<>?\x22]"," ">," +"," ">


The inner:
<regex-replace:$newtext:,"\[.+\]$">
removes the [YATV.ts] suffix, then punctuation is replaced with a space, and finally multiple spaces are converted to a single space.