Replacing Middle of File Name

A swapping-ground for Regular Expression syntax

Replacing Middle of File Name

Postby bigdog » Mon Dec 07, 2015 8:33 pm

I have read all the posts and still can't figure this out. I want to rename

01-07-16 American Airlines Center vs Stars vs. Jets 218 A 1

to

01-07-16 Dallas Stars - American Airlines Center 218 A 1

The first 8 characters will a date (mm-dd-yy). The "Jets" is a team name and can be anything. The "1" is a seat number and will be 1,2,3 or 4.

So basically I want to replace
"American Airlines Center vs Stars vs. <teamname>" <teamname> in the above example is "Jets" but can be anything.
with
"Dallas Stars - American Airlines Center" leaving the date at the beginning and the seat location (218 A 1) at the end.

Thanks.
bigdog
 
Posts: 3
Joined: Mon Dec 07, 2015 8:20 pm

Re: Replacing Middle of File Name

Postby Stefan » Mon Dec 07, 2015 10:02 pm

 

You mean

FROM:
01-07-16 American Airlines Center vs Stars vs. Jets 218 A 1

TO:
01-07-16 add(Dallas Stars -) American Airlines Center remove(vs Stars vs. Jets) 218 A 1


IOW:
Match date and seat location and add "Dallas Stars - American Airlines Center" in between?



Try (untested):

RegEx(1)
Match: ^(.{9}).+( \d+.+)$
Replace \1Dallas Stars - American Airlines Center\2


Hoping your teams have no digit in name.
If seat location is always: three digits, one char, one digit, then try

RegEx(1)
Match: ^(.{9}).+( \d{3} [A-Z] \d)$
Replace \1Dallas Stars - American Airlines Center\2



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

Re: Replacing Middle of File Name

Postby bigdog » Mon Dec 07, 2015 10:16 pm

I'll give it a try. Thanks.
bigdog
 
Posts: 3
Joined: Mon Dec 07, 2015 8:20 pm


Return to Regular Expressions