Need help removing (*) from filenames

A swapping-ground for Regular Expression syntax

Need help removing (*) from filenames

Postby mdotcarter » Fri Aug 04, 2006 9:14 pm

Hey, I know the basics of the syntax for using BRU, and here is my problem.

I have a bunch of file name that have a name and then (something) in them, for example:

filename (1234).exe

and as far as I can tell, the expression to remove the (1234) should be:

\(.*\)

which works in the RegEx Coach, but it doesn't do anything in BRU.

Thanks everyone in advance!

Also, I assumed it would be the same, but I also need to remove some [1234] from the filenames. Thanks again.
mdotcarter
 
Posts: 2
Joined: Fri Aug 04, 2006 8:49 pm

Postby AbteriX » Fri Aug 04, 2006 11:43 pm

Hi m,

you are on the right way.

>filename (1234).exe
>and as far as I can tell, the expression to remove the (1234) should be:
>\(.*\)

But you have to search and find and replace what you
wanna keep too:

filename (1234).exe
Search: (.+) \(.+\)
Replace: \1


filename (1234) somestring.exe
Search: (.+) \(.+\) (.+)
Replace: \1 \2


filename [1234].exe
Search: (.+) \[.+\]
Replace: \1

------------------------------
If you have
filename(1234).exe
filename (1234).exe
you could search for (.+)\s*\(.+\)

\s* search for null or more blanks.


Happy BRUing
AbteriX
 
Posts: 12
Joined: Sun Mar 12, 2006 4:24 pm

Postby mdotcarter » Sat Aug 05, 2006 7:07 am

:P You are awesome! Thanks. Now if all these files weren't so randomly named (booooo.....)
mdotcarter
 
Posts: 2
Joined: Fri Aug 04, 2006 8:49 pm

Postby Admin » Sat Aug 05, 2006 8:05 am

Cool, many thanks for solving this one so quick :D



Jim
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Postby AbteriX » Sat Aug 05, 2006 11:54 am

Great it works and i can give a lil bit back for this wonderful tool.
AbteriX
 
Posts: 12
Joined: Sun Mar 12, 2006 4:24 pm

Postby Jane » Sat Aug 05, 2006 11:11 pm

Am I losing it or is this not the same question asked 7 questions back "How to remove text between and including brackets" by trw on the May 08 posting?
Jane
 
Posts: 24
Joined: Sat Aug 05, 2006 1:20 am

Postby AbteriX » Sat Aug 05, 2006 11:22 pm

Jane wrote:Am I losing it or is this not the same question asked
7 questions back "How to remove text between and including brackets"
by trw on the May 08 posting?

Yes, this may be.
But to simply ask is even easier
then searching the forum while
not knowing what to search for in detail.
Didn't we do this all from time to time? :lol:
AbteriX
 
Posts: 12
Joined: Sun Mar 12, 2006 4:24 pm

Postby Jane » Sun Aug 20, 2006 7:42 am

I understand. Some forums with hundreds of entries can be daunting. I guess I was thinking of poor Jim and his "Please read before posting" request:

All users are encouraged to read these forums before posting questions. Many people ask questions which have already been asked (and answered) before.

This means I can spend less time answering questions (again) and more time developing the software Smile

Many thanks for your assistance.


Jim


I had the same question and found the answer in the previous reply. That's why it caught my eye.
This regex forum isn't too long, but if you give it your best shot and can't find an answer I agree you should ask.
Jane
 
Posts: 24
Joined: Sat Aug 05, 2006 1:20 am


Return to Regular Expressions