Months, and months abbreviated
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
you are correct i missed the blank space it should be
Replace \s{2,}
Replace with "a blank space"
all
use regular expression
name
Reply to #9:
HOBBS,
I know this is very late, you've probably already done your files using other methods, but I just was browsing and came across this problem and as an exercise I wrote a script that does *approximately* what you wanted. You said,
> "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."
Most of it is easy, but there are some cases that cause problems. I think I have taken care of MOST of the problems, but maybe not all. Anyway, this is just a brute-force script that takes two cases:
1) Month-name or Month-abbreviation is somewhere inside the filename, excluding proper names, and
2) Month-name or Month-abbreviation is at the tail-end of the filename.
It's all just (string).replace() statements, so it could actually be recreated in a bunch of Replace methods without javascript, but that's even more trouble than writing this code. :) Anyway, here's the script, this all goes in the main script window:
// --------------------------------------------------------------------------------
// REMOVE MONTH NAMES/ABBREVIATIONS, NOT PEOPLE NAMES
/*
1) If you have a month-name or abbreviation that ends the TITLE (not the
file), it must be followed by an apostrophe ('), a comma (,), or
a typesetter's close-quote ( ” which is Alt+0148).
2) If a month name/abbrev. is IN a title it must be followed by
a comma or a word that starts with a capital letter.
3) If there are commas in the dates part (after names & title) there
must be a YEAR (YYYY) before the parts with the comma(s).
4) This script makes a few minor changes in punctuation as a necessity
before looking for months. If you don't like the changes they aren't
hard to change back using postfixed methods.
[You can make your titles look spiffy, IMO, by using typesetter's
open-quote and close-quote marks ( “ and ” - Alt+0147 and Alt+0148).
It also makes it easier to deal with renaming tasks, since you always
know what's before and after the title and what's IN the title.]
*/
file = item.newBasename ;
file2 = file ;
// Add a comma after the last character before the first YEAR (YYYY):
pattern = /(\w[^,]) (\d{4}) /g ;
file = file2.replace( pattern, "$1, $2 " ) ;
file2 = file ;
// Remove spaces before commas:
pattern = / ,/g ;
file = file2.replace( pattern, "," ) ;
file2 = file ;
// Standardize some characters:
pattern = / *(\.{2,4}|…|_|-) */g
file = file2.replace( pattern, " - " ) ;
file2 = file ;
// Remove commas after words that come after the first year (YYYY):
pattern = /(\d\d\d\d)([^,]*),/g ;
file = file2.replace( pattern, "$1 $2 " ) ;
file2 = file ;
// \bJan\b
pattern = /\b[Jj]an\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJan$
pattern = /\b[Jj]an[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJanuary\b
pattern = /\b[Jj]anuary\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJanuary$
pattern = /\b[Jj]anuary[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bFeb\b
pattern = /\b[Ff]eb\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bFeb$
pattern = /\b[Ff]eb[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bFebruary\b
pattern = /\b[Ff]ebruary\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bFebruary$
pattern = /\b[Ff]ebruary[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bMar\b
pattern = /\b[Mm]ar\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMar$
pattern = /\b[Mm]ar[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bMarch\b
pattern = /\b[Mm]arch\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMarch$
pattern = /\b[Mm]arch[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bApr\b
pattern = /\b[Aa]pr\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMar$
pattern = /\b[Aa]pr[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bApril\b
pattern = /\b[Aa]pril\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bApril$
pattern = /\b[Aa]pril[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bMay\b
pattern = /\b[Mm]ay\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMay$
pattern = /\b[Mm]ay[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJun\b
pattern = /\b[Jj]un\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJun$
pattern = /\b[Jj]un[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJune\b
pattern = /\b[Jj]une\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJune$
pattern = /\b[Jj]une[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJul\b
pattern = /\b[Jj]ul\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJul$
pattern = /\b[Jj]ul[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJuly\b
pattern = /\b[Jj]uly\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJune$
pattern = /\b[Jj]uly[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bAug\b
pattern = /\b[Aa]ug\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bAug$
pattern = /\b[Aa]ug[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bAugust\b
pattern = /\b[Aa]ugust\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bAugust$
pattern = /\b[Aa]ugust[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bSep\b
pattern = /\b[Ss]ept?\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bSep$
pattern = /\b[Ss]ept?[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bSeptember\b
pattern = /\b[Ss]eptember\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bSeptember$
pattern = /\b[Ss]eptember[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bOct\b
pattern = /\b[Oo]ct\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bOct$
pattern = /\b[Oo]ct[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bOctober\b
pattern = /\b[Oo]ctober\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bOctober$
pattern = /\b[Oo]ctober[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bNov\b
pattern = /\b[Nn]ov\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bNov$
pattern = /\b[Nn]ov[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bNovember\b
pattern = /\b[Nn]ovember\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bNovember$
pattern = /\b[Nn]ovember[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bDec\b
pattern = /\b[Dd]ec\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bDec$
pattern = /\b[Dd]ec[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bDecember\b
pattern = /\b[Dd]ecember\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bDecember$
pattern = /\b[Dd]ecember[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// Remove redundant year-dates:
pattern = /\b(\d{4})(.*)\1/g ;
file = file2.replace( pattern, "$1" ) ;
file2 = file ;
// Remove extra spaces:
file = file2.replace( / +/g, " " ) ;
file2 = file ;
// Remove " - " ;
pattern = /( -)\1*/g ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// Remove spaces before title end:
pattern = / ([\.,'”])/g ;
file = file2.replace( pattern, "$1" ) ;
file2 = file ;
return file ;
// --------------------------------------------------------------------------------
I'm sure this could be written much more elegantly, but I don't seem to be up to anything more efficient than this today. Spent the morning playing with version 4.14 and that wore me out! :)
Best,
DF
HOBBS,
I know this is very late, you've probably already done your files using other methods, but I just was browsing and came across this problem and as an exercise I wrote a script that does *approximately* what you wanted. You said,
> "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."
Most of it is easy, but there are some cases that cause problems. I think I have taken care of MOST of the problems, but maybe not all. Anyway, this is just a brute-force script that takes two cases:
1) Month-name or Month-abbreviation is somewhere inside the filename, excluding proper names, and
2) Month-name or Month-abbreviation is at the tail-end of the filename.
It's all just (string).replace() statements, so it could actually be recreated in a bunch of Replace methods without javascript, but that's even more trouble than writing this code. :) Anyway, here's the script, this all goes in the main script window:
// --------------------------------------------------------------------------------
// REMOVE MONTH NAMES/ABBREVIATIONS, NOT PEOPLE NAMES
/*
1) If you have a month-name or abbreviation that ends the TITLE (not the
file), it must be followed by an apostrophe ('), a comma (,), or
a typesetter's close-quote ( ” which is Alt+0148).
2) If a month name/abbrev. is IN a title it must be followed by
a comma or a word that starts with a capital letter.
3) If there are commas in the dates part (after names & title) there
must be a YEAR (YYYY) before the parts with the comma(s).
4) This script makes a few minor changes in punctuation as a necessity
before looking for months. If you don't like the changes they aren't
hard to change back using postfixed methods.
[You can make your titles look spiffy, IMO, by using typesetter's
open-quote and close-quote marks ( “ and ” - Alt+0147 and Alt+0148).
It also makes it easier to deal with renaming tasks, since you always
know what's before and after the title and what's IN the title.]
*/
file = item.newBasename ;
file2 = file ;
// Add a comma after the last character before the first YEAR (YYYY):
pattern = /(\w[^,]) (\d{4}) /g ;
file = file2.replace( pattern, "$1, $2 " ) ;
file2 = file ;
// Remove spaces before commas:
pattern = / ,/g ;
file = file2.replace( pattern, "," ) ;
file2 = file ;
// Standardize some characters:
pattern = / *(\.{2,4}|…|_|-) */g
file = file2.replace( pattern, " - " ) ;
file2 = file ;
// Remove commas after words that come after the first year (YYYY):
pattern = /(\d\d\d\d)([^,]*),/g ;
file = file2.replace( pattern, "$1 $2 " ) ;
file2 = file ;
// \bJan\b
pattern = /\b[Jj]an\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJan$
pattern = /\b[Jj]an[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJanuary\b
pattern = /\b[Jj]anuary\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJanuary$
pattern = /\b[Jj]anuary[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bFeb\b
pattern = /\b[Ff]eb\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bFeb$
pattern = /\b[Ff]eb[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bFebruary\b
pattern = /\b[Ff]ebruary\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bFebruary$
pattern = /\b[Ff]ebruary[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bMar\b
pattern = /\b[Mm]ar\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMar$
pattern = /\b[Mm]ar[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bMarch\b
pattern = /\b[Mm]arch\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMarch$
pattern = /\b[Mm]arch[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bApr\b
pattern = /\b[Aa]pr\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMar$
pattern = /\b[Aa]pr[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bApril\b
pattern = /\b[Aa]pril\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bApril$
pattern = /\b[Aa]pril[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bMay\b
pattern = /\b[Mm]ay\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bMay$
pattern = /\b[Mm]ay[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJun\b
pattern = /\b[Jj]un\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJun$
pattern = /\b[Jj]un[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJune\b
pattern = /\b[Jj]une\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJune$
pattern = /\b[Jj]une[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJul\b
pattern = /\b[Jj]ul\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJul$
pattern = /\b[Jj]ul[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bJuly\b
pattern = /\b[Jj]uly\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bJune$
pattern = /\b[Jj]uly[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bAug\b
pattern = /\b[Aa]ug\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bAug$
pattern = /\b[Aa]ug[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bAugust\b
pattern = /\b[Aa]ugust\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bAugust$
pattern = /\b[Aa]ugust[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bSep\b
pattern = /\b[Ss]ept?\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bSep$
pattern = /\b[Ss]ept?[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bSeptember\b
pattern = /\b[Ss]eptember\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bSeptember$
pattern = /\b[Ss]eptember[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bOct\b
pattern = /\b[Oo]ct\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bOct$
pattern = /\b[Oo]ct[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bOctober\b
pattern = /\b[Oo]ctober\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bOctober$
pattern = /\b[Oo]ctober[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bNov\b
pattern = /\b[Nn]ov\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bNov$
pattern = /\b[Nn]ov[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bNovember\b
pattern = /\b[Nn]ovember\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bNovember$
pattern = /\b[Nn]ovember[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bDec\b
pattern = /\b[Dd]ec\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bDec$
pattern = /\b[Dd]ec[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// \bDecember\b
pattern = /\b[Dd]ecember\b([^\.,'”])([^A-Z])/g ;
file = file2.replace( pattern, "$2" ) ;
file2 = file ;
// \bDecember$
pattern = /\b[Dd]ecember[\W]*$/ ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// Remove redundant year-dates:
pattern = /\b(\d{4})(.*)\1/g ;
file = file2.replace( pattern, "$1" ) ;
file2 = file ;
// Remove extra spaces:
file = file2.replace( / +/g, " " ) ;
file2 = file ;
// Remove " - " ;
pattern = /( -)\1*/g ;
file = file2.replace( pattern, "" ) ;
file2 = file ;
// Remove spaces before title end:
pattern = / ([\.,'”])/g ;
file = file2.replace( pattern, "$1" ) ;
file2 = file ;
return file ;
// --------------------------------------------------------------------------------
I'm sure this could be written much more elegantly, but I don't seem to be up to anything more efficient than this today. Spent the morning playing with version 4.14 and that wore me out! :)
Best,
DF
Reply to #10
Ok it works great, sorry about that but i somehow added an extra line at the end and i don;t see well
with small print of course there could of been some other reason.
thank you very much i know your good at this but it still took time, thank you.
Ok it works great, sorry about that but i somehow added an extra line at the end and i don;t see well
with small print of course there could of been some other reason.
thank you very much i know your good at this but it still took time, thank you.