Remove all Email Addresses from File Name

A swapping-ground for Regular Expression syntax

Remove all Email Addresses from File Name

Postby yluciano » Fri Mar 25, 2011 5:44 pm

I thought I was highly intelligent until I came into the concept of regular expressions. So I know many who are good with regular expressions will problably bang their heads against the wall and yell profanities at me. To those I sincerely apologize. Forgive me for being such an idiot.

Having said that I hope someone would be kind enough to help. I have thousands of files that are similarly named as the examples below:

2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kile Quinn kileq@mccarran.com - Alana Zwanziger AlanaZ@mccarran.com (04-03-2011).pdf
2152 Email 05188 CLOSED (Louver Install for Doghouses on Roof) Denis Jew Denisj@mccarran.com - Alana Zwanziger AlanaZ@mccarran.com (07-03-2011).pdf
2152 Email 16700 Cable Testing Documentation Kennrick Katz Kennrickk@mccarran.com - Alenn Potter AlennP@mccarran.com (23-03-2011).pdf
2152 Email A9.300 Rev 2 - Issued Suqui Bromwich SuquiB@mccarran.com - Alana Zwanziger AlanaZ@mccarran.com (04-03-2011).pdf

I want the email addresses to be removes so that they respectively read:

2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kile Quinn - Alana Zwanziger (04-03-2011).pdf
2152 Email 05188 CLOSED (Louver Install for Doghouses on Roof) Denis Jew - Alana Zwanziger (07-03-2011).pdf
2152 Email 16700 Cable Testing Documentation Kennrick Katz - Allen Potter (23-03-2011).pdf
2152 Email A9.300 Rev 2 - Issued Suqui Bromwich - Alana Zwanziger (04-03-2011).pdf

Maybe their is a regular expression that detects emails and wipes them out. Or maybe I need to have a more complicated regular expression that would detect any word ending with "@mccarran.com." I prefer the former but honestly, I would not know how to begin with any of the options.

Again, I do understand that I may be asking a dumb question. But I do not have the time right now to learn a programing language. If anyone would be so gracious to offer me a hand, I will worship you.
Last edited by yluciano on Wed Mar 30, 2011 10:41 pm, edited 1 time in total.
yluciano
 
Posts: 3
Joined: Fri Mar 25, 2011 5:32 pm

Re: Remove all Email Addresses from File Name

Postby Stefan » Fri Mar 25, 2011 8:58 pm

Hi yluciano, welcome!

There is nothing to worry about... i am sure you know many things i never heard of ;-)

Remove all Email Addresses from File Name

FROM:
2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kyle Quinn kyleq@mc_carran.com - Alan Zwanziger AlanZ@mc_carran.com (04-03-2011)
TO:
2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kyle Quinn - Alan Zwanziger (04-03-2011)


Would you please test if this works:

- test with copies of your real files before you mess smtg up
- open the folder with your files in BRU
- select one, a few or all files to see in the preview what happens

- now we match

for
2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kyle Quinn kyleq@mc_carran.com - Alan Zwanziger AlanZ@mc_carran.com (04-03-2011)

this parts
(all signs till an blank ) ==> 2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kyle Quinn "
followed by "an group of signs" followed by "an @-sign" followed by "an group of signs" followed by "an blank" ==> "kyleq@mc_carran.com "
followed by (an group of signs till an blank ) ==> "- Alan Zwanziger "
followed by "an group of signs" followed by "an @-sign" followed by "an group of signs" followed by "an blank" ==> "AlanZ@mc_carran.com "
followed by (the rest) ==> " (04-03-2011)"

Only those parts matched inside the parentheses (...) are used for the output by using \1\2\3, all others are dropped.


- in BRU use RegEx(1)
Match: (.+ ).+@.+? (.+ ).+@.+ (.+)
Repla: \1\2\3

Note that this works only for the examples you have provided.
If other files are named different this solution may fail.
Maybe we have to in- or exclude one or another blank to one or more groups?
Or perhaps have to use more '?' signs to switch to non-greedy match?
And... - i need an bigger screen for such tasks :-(


An first test looks like:
Input:
2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kyle Quinn kyleq@mc_carran.com - Alan Zwanziger AlanZ@mc_carran.com (04-03-2011)
2152 Email 05188 CLOSED (Louver Install for Doghouses on Roof) Dennis Jew Dennisj@mc_carran.com - Alan Zwanziger AlanZ@mc_carran.com (07-03-2011)
2152 Email 16700 Cable Testing Documentation Kenrick Kautz Kenrickk@mc_carran.com - Allen Porter AllenP@mc_carran.com (23-03-2011)
2152 Email A9.300 Rev 2 - Issued Suki Bromwich SukiB@mc_carran.com - Alan Zwanziger AlanZ@mc_carran.com (04-03-2011)
Putput:
2152 Email 05124 CLOSED (Mezzanine Framing at Escalators) Kyle Quinn - Alan Zwanziger (04-03-2011)
2152 Email 05188 CLOSED (Louver Install for Doghouses on Roof) Dennis Jew - Alan Zwanziger (07-03-2011)
2152 Email 16700 Cable Testing Documentation Kenrick Kautz - Allen Porter (23-03-2011)
2152 Email A9.300 Rev 2 - Issued Suki Bromwich - Alan Zwanziger (04-03-2011)

HTH? :D
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Remove all Email Addresses from File Name

Postby Stefan » Wed Mar 30, 2011 6:40 am

@Admin

I have overseen that that are valid email addresses... you may want to modify them in the first posting -as i did in mine- to prevent spam...


.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Remove all Email Addresses from File Name

Postby yluciano » Wed Mar 30, 2011 10:42 pm

Thank you for being so gracious Stephen. I have altered the email addresses as you have suggested. Thanks for the tip. I will see how it works out. Thanks.
yluciano
 
Posts: 3
Joined: Fri Mar 25, 2011 5:32 pm

Re: Remove all Email Addresses from File Name

Postby yluciano » Wed Mar 30, 2011 10:49 pm

Stephan. You are the man! Thank you so much! You could only imagine how thankful I am! Now for my worship of you:

You are the man of the hour
The power tower
Too sweet to be sour
The man, the myth, the legend
Loved by children of all ages.
The doctor!
yluciano
 
Posts: 3
Joined: Fri Mar 25, 2011 5:32 pm


Return to Regular Expressions