Page 1 of 1

Match Pattern - does not recognize the pattern

PostPosted: Sat Aug 28, 2021 7:23 am
by Hazel-Chris
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

Re: Match Pattern - does not recognize the pattern

PostPosted: Mon Aug 30, 2021 10:28 am
by Mr_Noodle
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.

Re: Match Pattern - does not recognize the pattern

PostPosted: Mon Aug 30, 2021 12:00 pm
by Hazel-Chris
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?

Re: Match Pattern - does not recognize the pattern

PostPosted: Tue Aug 31, 2021 10:04 am
by Mr_Noodle
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.

Re: Match Pattern - does not recognize the pattern

PostPosted: Thu Sep 02, 2021 12:01 pm
by Hazel-Chris
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.

Re: Match Pattern - does not recognize the pattern

PostPosted: Fri Sep 03, 2021 4:44 pm
by Mr_Noodle
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.