Match Pattern - does not recognize the pattern

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi

I want to rename folders.
They come in the format:

"P123-200-100-B - Name of folder"

I would like to remove "P123 - " so that the Folder is called "200-100-B - Name of folder".

So I start doing a condition:

If
Name - matches - CustomText="P123"
then
Rename - with pattern - ChosePattern-->Replacetext 'P123 - " with "" (i leave this empty).

When I do the "Rule Preview" it says that it does not recognise the "P123".

I can;t see this explained in the help file, so help would be appreciated.

Chris
Hazel-Chris
 
Posts: 3
Joined: Sat Aug 28, 2021 4:15 am

If you are matching against name, the pattern has to cover every character in the name, not just the part you are interested in. I believe this is covered in the manual. You would create a custom attribute to match the part you want to keep.

In the Rename pattern, you would include that custom attribute. You would not use the Replace text function in this case.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I found similar questions like mine in the forum and I can see that you then always refer to the Manual.

But I can't figure from the manual how to solve this.

I guess that if I don't understand this answer, that I am not competent enough to use Hazel then.

Or are there maybe explanatory examples where I haven't found it yet?
Hazel-Chris
 
Posts: 3
Joined: Sat Aug 28, 2021 4:15 am

Your pattern needs to account for everything in the name, not just the part you are interested in. Every character has to be accounted for.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for coming back to me again. I can see that with repeating your answer you think that I will understand better.
An example would be really cool sometimes, maybe also for toehr users who search for this issue and find this thread.

So in my example I would think I have to do the following to find folder "P123-200-100-B - Name of folder"

P123-"123"-"123"-"a" - "ab12%?"
so
P123-Number-Number-letter- Characters

But it doesn't recognize the folder in the rule preview.

I don't understand how to use the patern and it's not clear or at least not easy to understand in the manual, I think.
Sorry.
Hazel-Chris
 
Posts: 3
Joined: Sat Aug 28, 2021 4:15 am

Can you post a screenshot of the preview? For the condition/pattern that doesn't match, click the red X to show what the value is there.
Mr_Noodle
Site Admin
 
Posts: 9709
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support