Need regex rename - prompt for character, replace with space

can someone help me with a regex rename function that will ask me for a character, then replace all instances of that character with a space?

i do this often, but it's usually a different character every time.

thanks!

i just realized this isn't necessary. i can just make a replace command that changes the most common characters to spaces. there are three i come across often [ - _ . ] so that should cover most everything...

i wish i could edit my posts...

ok i solved the above issue, but i still need help with a script. i want a button that will prompt for a string, then replace the names all selected files with that string, followed by a space, followed by sequential numbers.

if i enter 'new' when prompted:

file21.txt > new 001.txt
test_f.txt > new 002.txt
apple.txt > new 003.txt

i'm making a 'rename' menu filled with useful stuff. i'll post it when i'm done :slight_smile:

sorry, i just realized there is a toolbar posted with this exact function in it...

don't mind me, i'm a bit slow today :wink:

If you could edit your posts then nobody who had read the originals would see the edits and know there was an outstanding question. That and the other reasons we don't allow editing in the Help & Support forum (as described in the FAQ on why post editing is disabled):

[Why can't I edit my posts?)

yes i know, but i can still wish...

i don't think i'll ever get the hang of regex! i wish i had a stronger background in programming...

[quote="garbanzo"]can someone help me with a regex rename function that will ask me for a character, then replace all instances of that character with a space?

i do this often, but it's usually a different character every time.

thanks![/quote]

Why? While I admire your enthusiasm for RegEx, why bother with regex for such a thing? Why not just use the normal Find and Replace in Advanced Rename? For example there you can just enter whatever character you want and whatever character/phrase/sentence/paragraph/chapter/book you want to replace it with. And, from the preview panel you an see what will happen before you commit.

Regex is not for mortals:)

hey, i'm not a mortal! :confused:

yes i know it's much easier to use the rename dialog, but i was trying to make my own button to clean up file names, since the ones published don't do what i want. i got it mostly working, but it gets confused if the file name is too cluttered...

anyway, it's more fun to do things the hard way. how else does a person learn new things?

i tried reading up on regex elsewhere, but i can't find a guide covering the specific style used in DOpus. i can't even find a full list of the available arguments... does anyone have a link for me? (yes, i read leo's fantastic introduction and other threads, but i find myself wanting more)

but i worked hard on this while at work yesterday, and i think now i could do what i asked originally. i'll give it a try later :slight_smile:

hey, i'm not a mortal! :confused:

yes i know it's much easier to use the rename dialog, but i was trying to make my own button to clean up file names, since the ones published don't do what i want. i got it mostly working, but it gets confused if the file name is too cluttered...

anyway, it's more fun to do things the hard way. how else does a person learn new things?

i tried reading up on regex elsewhere, but i can't find a guide covering the specific style used in DOpus. i can't even find a full list of the available arguments... does anyone have a link for me? (yes, i read leo's fantastic introduction and other threads, but i find myself wanting more)

but i worked hard on this while at work yesterday, and i think now i could do what i asked originally. i'll give it a try later :slight_smile:

There can only be one you know.

These links might possibly be useful to you. If you need more, then maybe check out amazon.com for books on the subject. :slight_smile:

http://regexlib.com/CheatSheet.aspx
http://www.regular-expressions.info/reference.html

There's a list in the appendix at the back of the manual and online help.

sorry for the double post, the forum was acting up on me earlier...

thanks for the links Zach. i have already spent a lot of time at the second site you suggested, but the variables and syntax they outline is different enough to that used by DOpus that i got befuddled...

and leo - i saw that list, but i assumed (hoped?) there were more expressions than that. or at least a better explanation somewhere of how these elements can be combined to achieve results.

at any rate, i'll keep reading and fiddling. regex seems like a very useful tool, and one that is within my reach - something i can learn on my own...

hint: Regular expression is not actually that difficult. Read one of the linked texts on the general concepts then the section in Opus manual on regular expression then just play around for a while - maybe the weekend:)

you're right, Greg. i was just letting myself be intimidated by the abstractness of it all.

i managed to very easily modify Zippo's period-to-space solution to fit my needs:

@NoDeselect Rename REGEXP PATTERN="(.*)(([^0-9])\.]|\.([^0-9])|-|_)(.*\..*)#" TO="\1\3 \4\5" Rename CASE=allwords

What fun!

Be careful. It wasn't until I read another discussion here that, like you, I discovered that regex comes in various flavours.

Reference material and stuff that works for one implementation will not work for others.

The DOpus help material has some good stuff but is let down by the fact that the Help "Search" does not show anything on regex. A search in the PDF file will also not find the helpful appendix on the subject. You have s=to look for "regular".

As an aside, on another forum, a DOpus user asked: "What other file search utility lets you use Regular Expressions to find exactly what you're looking for?"

This implies that DOpus alone offers this feature. FindOnClick does too. ("FindOnClick uses Perl-compatible Regular Expressions (PCRE). ")

I have no idea if FindOnClick is better in any way, but it doesn't do to let misconceptions pass.

Anyone with FindOnClick will see that it also has a section on regex in the Help file, with a bunch of possibly useful examples. But don't try searching for "regex" as they also miss out this obvious signpost for searchers after the truth.

haha that was me! lifehacker, right? anyway i didn't mean to imlply DOpus was the only search tool to use regex. i know it's not, there are many other regex file search tools for windows. i was just promoting DOpus a little bit. gotta do my part! after all, it's because of LH that i found DOpus in the first place...

i know there are several different versions of regex. the one used here seems pretty simple, but it's powerful nonetheless. but yes, i too wish it were better documented.

Ha ha indeed. But what possessed you to plug DOpus in a poll on desktop search software?

This is one of the few file management things that it does not claim to do.

By plugging its ability to connect to Windows Desktop Search, DOpus acknowledges that it is not in the same game. Nor should it be.

Desktop search (DTS) is not the same as search. DTS is all about finding files instantly – or as quickly as your PC can hack it – which means indexing the whole caboodle. The very thought that of using search, DOpus or otherwise, to sift through 87,331 PDF files (my current count) for complex word combinations fills me with gloom.

On the regex thing, I find that "worked examples" are the best way to get my tiny brain around the concept.

Opus doesn't connect to Windows Search (yet). Maybe you've confusing it with Google Desktop.