Delete all before a word

Advanced Renamer forum
#1 : 05/01-13 16:45
L
L
Posts: 11
Hi,i have a problem: i have some file with name like:
-hiuc390721hjPhoto20
-dhoh43uophva67dPhoto numer21
-etc.

How i can do for delete all the name before "photo"? the problem is that not always the character before Photo is the same number,so i can't use delete substring :(


05/01-13 16:45 - edited 05/01-13 19:59
#2 : 05/01-13 22:48
Stefan
Stefan
Posts: 262
Reply to #1:

i would try an regular expression:

Find: (.+)(Photo.+)
Replace: $2


Explanation:
the first matching group () will match everything till 'Photo'
the second will match 'Photo and the rest'

With $1 you would get what is matched in the first group,
with $2 that what is cached in the second.

So simple replace with $2 and drop what is matched in $1



HTH? :D

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


05/01-13 22:48
#3 : 05/01-13 23:37
L
L
Posts: 11
Sorry but i don't understand were i must insert this word.
I had created a method replace, put the first line in the first place,and the second in the second,but it does anything :(


05/01-13 23:37
#4 : 06/01-13 00:39
Stefan
Stefan
Posts: 262
Reply to #3:

Did you read the help and tried to understand?

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


06/01-13 00:39
#5 : 06/01-13 12:50
L
L
Posts: 11
Reply to #4:
sorry,but i think i don't understand what you mean with regular expression. You mean a script?


06/01-13 12:50
#6 : 06/01-13 13:13
Stefan
Stefan
Posts: 262
Reply to #5:

You should not waste your time with waiting for answers but just read the fine manual:

http://www.advancedrenamer.com/user_guide/regul ar_expresions

http://www.advancedrenamer.com/user_guide/metho d_replace




You can even use google to get a glue what regular expressions means.
http://en.wikipedia.org/wiki/Regular_expression



But for the lazy one:

- add a Replace Rule
- check "[X] Use regular expressions"
- In the Find box (here called "Text to be replaced") put the RegEx expression: (.+)(Photo.+)
- In the Replace with field put the replace expression: $2

And then... just try it out. Read and try again. No need for others to do your homework.
If you test this with copies of your real files you can't mess up anything.
You will maybe lose one hour of your life but you will learn how it works for ever.

Hope this helps?

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


06/01-13 13:13 - edited 06/01-13 13:14
#7 : 07/01-13 12:55
L
L
Posts: 11
Reply to #6:
sorry,now i have understand and it works :) thanks a lot :)


07/01-13 12:55