#1 2018-06-11 22:16

kaos
Member
Registered: 2018-06-11
Posts: 2

Is there a special code that acts as any character?

I am trying to use the delete rule to remove the last few characters of a batch of files.  This is my dilemma every file has "t18" in it but after that each file has a 2 unique characters. For an example:

random_file_t18af(every character after 'f' i want to delete)
random_file_t18bg(every character after 'g' i want to delete)
random_file_t18st(every character after 't' i want to delete)
random_file_t18oz(every character after 'z' i want to delete)

Is there a special code to insert that acts as the next two characters (i.e. t18**)

I am not sure of another approach to solve this issue. I appreciate all the help and support.

Offline

#2 2018-06-12 00:32

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: Is there a special code that acts as any character?

You have several options: Wildcards, Regular Expressions or Pascal Script.

Wildcards are the easiest option. It is available in the Remove and Replace rules.

Your particular problem can be solved with the following Replace rule:

Replace using wildcards "t18??*" with "t18$1$2" (skip extension)

(tick the "Interpret as wildcards" option)

If you take your examples:

random_file_t18af(every character after 'f' i want to delete)
random_file_t18bg(every character after 'g' i want to delete)
random_file_t18st(every character after 't' i want to delete)
random_file_t18oz(every character after 'z' i want to delete)

The output would be:

random_file_t18af
random_file_t18bg
random_file_t18st
random_file_t18oz

Offline

#3 2018-06-12 19:14

kaos
Member
Registered: 2018-06-11
Posts: 2

Re: Is there a special code that acts as any character?

Thank you so much for the help.  This solved my problem.

Offline

Board footer

Powered by FluxBB