You are not logged in.
Pages: 1
hi all,
I'm VERY new to regex-type text manipulation and my problem is fairly simple but I just can't get it to work. I have a group of music files (1000's of them) such as:
Counts (4) (Bobby Comstock & The) - The Beatle Bounce 1964 Lawn 229.mp3
Counts (4) (Bobby Comstock & The) - The Chicken Back - 63 Lawn 217.mp3
Counts (4) (Bobby Comstock & The) - The Garden Of Eden - 61 Festival 25000 ERROR.txt
Counts (4) (Bobby Comstock & The) - The Wayward Wind - 1960 Mohawk 124.mp3
Counts (4) (Bobby Comstock & The) - This Little Love Of Mine - 1963 Lawn 219.mp3
Counts (4) (Bobby Comstock & The) - Tra-La-La (I'm So Happy) - 1961 Marlee 104 Not Listed.mp3
Counts (4) (Bobby Comstock & The) - Your Big Brown Eyes - 1963 Jubilee 5396.mp3
and I want to change the part of the string "- 1963" using a wildcard for the last two digits of the year)
to just "- 63" again using wild cards for the last two digits of the year. In other words replace the string "dash, space, 4 digit year" with "dash, space, last 2 digits of year".
I was assuming a search on - 19??
and replacing with - ?? would work but obviously I am missing some syntax notations.
A second one would be replacing just the " 1963 " (spaces before and after the year as in the first entry) with "- 63 "
Anyone willing to help?
Thx in advance
Dan
Offline
Hello Dan,
Your idea was correct, you are just missing grouping and substitutions.
I want to change the part of the string "- 1963" using a wildcard for the last two digits of the year)
RegEx: Replace expression "- 19(\d\d)" with "- $1" (skip extension)
A second one would be replacing just the " 1963 " (spaces before and after the year as in the first entry) with "- 63 "
RegEx: Replace expression " 19(\d\d)" with " - $1" (skip extension)
You can also do both operations in one rule:
RegEx: Replace expression "\s*-?\s*\b19(\d\d)\b" with " - $1" (skip extension)
The output will be:
Counts (4) (Bobby Comstock & The) - The Beatle Bounce - 64 Lawn 229.mp3
Counts (4) (Bobby Comstock & The) - The Chicken Back - 63 Lawn 217.mp3
Counts (4) (Bobby Comstock & The) - The Garden Of Eden - 61 Festival 25000 ERROR.txt
Counts (4) (Bobby Comstock & The) - The Wayward Wind - 60 Mohawk 124.mp3
Counts (4) (Bobby Comstock & The) - This Little Love Of Mine - 63 Lawn 219.mp3
Counts (4) (Bobby Comstock & The) - Tra-La-La (I'm So Happy) - 61 Marlee 104 Not Listed.mp3
Counts (4) (Bobby Comstock & The) - Your Big Brown Eyes - 63 Jubilee 5396.mp3
P.S. You might want to have a look at the manual for regular expressions.
Offline
Thx alot. It worked perfect. Time to start studying that manual with a little more understanding.
Dan
Offline
Pages: 1