can this be done using "replace" function

Advanced Renamer forum
#1 : 06/10-14 22:36
steve
steve
Posts: 1
Hi there,

I just installed this program and joined this forum. I am very unfamilar when it comes to technology like this and if possible I love some quick answers to some queries that I'd otherwise have to spend hours researching for answer.

Basically I want the replace feature to replace all underscores "_" with a space. Now that seems simple enough but here is the bit where I need help. I have lots of files that not only have underscores between words but within words. This occurs with words that have an apostrophe. So is it possible to create some code that the program will recognize that when a apostrophe is needed and not a space bar. So what I want is the program to recognize that when 1 or 2 letters follow an underscore and then those 1 or 2 letters are followed by another underscore that the first underscore should be changed to an apostrophe and the second a space bar.

I hope this makes since. Please go easy on me.


06/10-14 22:36
#2 : 07/10-14 10:01
Stefan
Stefan
Posts: 274
Reply to #1:
 


Hi and welcome.

Something like "Replace underscores with a space or apostrophe"
would have been a much better subject line for this topic
to let others with similar questions find this thread too.

Also a few “before” and “after” example names would had helped
a) for better understanding your request
b) for me to have the need examples for testing at hand without to have to create them myself


Examples (http://www.grammar-monster.com/lessons/apostrop hes_replace_letters.htm)

FROM:
Blood_s_not thicker than money, what_ll_that mean.txt
Sally isn_t_able to complete her work, but I_ll_be.txt

TO:
Blood's not thicker than money, what'll that mean.txt
Sally isn't able to complete her work, but I'll be.txt


- - -

To your question:
it is not easy to do an accurate grammatically guess where to insert an apostrophe,
but you already developed a usable rule to handle this issue:

Match: underscore + 1or2 letters + underscore
Replace: apostrophe + the matched letters + space

- - -

So try the Replace Method
(http://www.advancedrenamer.com/user_guide/metho d_replace)

with some test files


Find: _([a-z]{1,2})_
Replace: ‘$1#

Occu: [All] , or as you need
[X] RegEx

(Instead of the #-sign insert a space)



 


07/10-14 10:01