#1 : 19/02-25 00:36 HOBBS
Posts: 13
|
Maybe someone has a script and i did not see it
i have long folder names with the month or abbreviated month in them, removing them, if that was all, is easy, but the problem i have is what follows: Marie Martin, A long walk in the rain, Marie etc 1946 mar, 1954 June 1977 September 1977 March and there are thousands like this so when i remove mar i get ie tin A long walk in the rain .................... i also have problems with july, jul, Dec aug, jan, june ,jun april apl and may, because these words or there abbreviations are common to proper nouns. any help would be cool and i promise not to mess with the universe again |
#2 : 19/02-25 06:08 Delta Foxtrot
Posts: 431
|
Reply to #1:
Hey Hobbs, Here you go. This keys off the year dates, removing everything between and after them, leaving everything in front of the first date. I'm assuming you want the years left in; if not just leave the Replace with: field blank in the first replace and ignore the other replaces. The way I did it was with one List replace method, although you could use three Replace methods. (Quotation marks aren't entered; they're to demonstrate the places where spaces are needed) Regular expressions: CHECKED: 1. Remove everything between the year dates: Replace: "(\d{4})([^\d]+)" Replace with: "$1 " 2. Remove space at the end of the filename inserted by the first replace: Replace: " $" Replace with: "" (nothing) 3. (Optional) Insert a comma after all but the last year date: R: "(\d{4}) " R W: "$1, " Best, DF |
#3 : 19/02-25 21:21 HOBBS
Posts: 13
|
Reply to #2:
Thank you, it works very well from year on, in some cases the month is before the year, but i can clean that up with one or two other methods, at least all the junk from year on is removed, without causing conflict from before the year as the methods that i was trying did. I wonder how difficult it is to create a method-script that would remove all abbreviated months but never touch a proper noun, ie , Ann Martin, June Lockhart, in a play by M Paris 1954 mar,1961 June...jun-1964. remove mar but keep ann "MAR"tin remove june,jun but keep june lockhart all the proper nouns are before any abbreviated month. but in most cases there are other words scatted about after the proper nouns and even after the abbreviated month i just want all abbreviated months gone but not mess with the names thank you again |
#4 : 20/02-25 14:19 Miguel
Posts: 175
|
Reply to #3:
Hi HOBBS. You can use a REPLACE method. Something like this: REPLACE: jan/feb/mar/apr/may/jun/jul/aug/sept/oct/nov/dec REPLACE WITH: (empty) Case sensitive: Yes Apply to Name Miguel |
#5 : 20/02-25 21:34 HOBBS
Posts: 13
|
Reply to #4:
Thank you Miguel, but it replaces julie with ie as well as replaceing jul as empty mar or Mar as empty but marie as ie i have been doing most of it using a list, but i was hoping to find a way where all months abbreviated and only them would be removed from all folders thank you again |
#6 : 20/02-25 22:33 Delta Foxtrot
Posts: 431
|
Reply to #5:
Hey Hobbs, Just add a space on each side of each entry in Miguel's list. " jan / feb / mar / apr /"... etc It's not going to be perfect but it's close. You might have to go back and replace the trailing spaces with commas, or something else depending. Best, DF |
#7 : 20/02-25 23:13 HOBBS
Posts: 13
|
Reply to #6:
yes very close indeed, thanks alot everyone, Miguel and DF. this is much better than what i was doing going to save alot of time as for trailing spaces someone posted this awhile back replace \s{2,} leave empty all regular expression name thanks again |
#8 : 20/02-25 23:29 Delta Foxtrot
Posts: 431
|
Reply to #7:
That would replace 2 or more spaces together with nothing (the words on either side would the be stuck together). Is that what you meant to do? If you want just one space you'd put one space in the "Replace with:" field. Or you can just say replace \s+, or " +", with one space. That replaces all spaces with one space. You're replacing a single space with a single space, but you'll save a lot of time over writing the curlicues over and over. I use that at the end of most batches. |
#9 : 21/02-25 01:42 HOBBS
Posts: 13
|
Reply to #8:
you are correct i missed the blank space it should be Replace \s{2,} Replace with "a blank space" all use regular expression name |