Author Topic: Need to convert this list into Code Replacement acceptable format  (Read 11267 times)

Offline Ben Curtis

  • Member
  • **
  • Posts: 94
    • View Profile
    • Snappertalk blog
Need to convert this list into Code Replacement acceptable format
« on: September 20, 2009, 09:21:39 AM »
Hi,

I have this list of players and teams in a FIFA soccer tournament received from the organisers (attached). The data is in this format:

AUS 1 GK Andrew REDMAYNE - (Central Coast Mariners, AUS)
AUS 2 D Daniel MULLEN - (Adelaide Utd., AUS)
AUS 3 D Luke DEVERE - (Brisbane Roar, AUS)

The spaces between "AUS", "1", "GK", and "Andrew" are all Tabs. I want to use it as a code replacement, so think I need to get it into this format:

AUS1 Andrew Redmayne
AUS2 Daniel Mullen

i.e. I need to delete the extra information, remove some of the tabs, and convert words in ALLCAPS to first letter in uppercase, rest of word lowercase. I just need the name to be inserted into the caption, none of the team info. It would be useful to optionally include the playing-position, but that's not essential.

Can anyone help me as to how I can reformat the whole document this way without doing it all manually (it's rather long).

Many thanks in advance.....

[attachment deleted by admin]

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24731
    • View Profile
    • Camera Bits, Inc.
Re: Need to convert this list into Code Replacement acceptable format
« Reply #1 on: September 20, 2009, 10:05:57 AM »
Ben,

I have this list of players and teams in a FIFA soccer tournament received from the organisers (attached). The data is in this format:

AUS 1 GK Andrew REDMAYNE - (Central Coast Mariners, AUS)
AUS 2 D Daniel MULLEN - (Adelaide Utd., AUS)
AUS 3 D Luke DEVERE - (Brisbane Roar, AUS)

The spaces between "AUS", "1", "GK", and "Andrew" are all Tabs. I want to use it as a code replacement, so think I need to get it into this format:

AUS1 Andrew Redmayne
AUS2 Daniel Mullen

i.e. I need to delete the extra information, remove some of the tabs, and convert words in ALLCAPS to first letter in uppercase, rest of word lowercase. I just need the name to be inserted into the caption, none of the team info. It would be useful to optionally include the playing-position, but that's not essential.

Can anyone help me as to how I can reformat the whole document this way without doing it all manually (it's rather long).

Are you familiar with 'regular expressions'?  Do you have a text editor that can do regular expressions?

-Kirk

Offline Ben Curtis

  • Member
  • **
  • Posts: 94
    • View Profile
    • Snappertalk blog
Re: Need to convert this list into Code Replacement acceptable format
« Reply #2 on: September 20, 2009, 10:13:56 AM »
I'm not familiar with it, but am quick learner and have OS X and Win if needed.
Since I wrote that post I've actually had some luck playing with find/replace in Word, and have now got it down to:

AUS1    goalkeeper Andrew REDMAYNE - (Central Coast Mariners, AUS)
AUS2    defender Daniel MULLEN - (Adelaide Utd., AUS)
AUS3 defender Luke DEVERE - (Brisbane Roar, AUS)

Now, I'm just having trouble doing two things:

1. delete everything after and including the " - " [space dash space, onwards, up to the ")"] on each line
2. Find a way to look for a word that's in "ALLCAPS" and replace it with "Allcaps"


Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24731
    • View Profile
    • Camera Bits, Inc.
Re: Need to convert this list into Code Replacement acceptable format
« Reply #3 on: September 20, 2009, 12:19:00 PM »
Ben,

I'm not familiar with it, but am quick learner and have OS X and Win if needed.
Since I wrote that post I've actually had some luck playing with find/replace in Word, and have now got it down to:

AUS1    goalkeeper Andrew REDMAYNE - (Central Coast Mariners, AUS)
AUS2    defender Daniel MULLEN - (Adelaide Utd., AUS)
AUS3 defender Luke DEVERE - (Brisbane Roar, AUS)

Now, I'm just having trouble doing two things:

1. delete everything after and including the " - " [space dash space, onwards, up to the ")"] on each line
2. Find a way to look for a word that's in "ALLCAPS" and replace it with "Allcaps"

#1 can be done with a regular expression.  #2, would need a specific feature in your text editor.

-Kirk

Offline Ben Curtis

  • Member
  • **
  • Posts: 94
    • View Profile
    • Snappertalk blog
Re: Need to convert this list into Code Replacement acceptable format
« Reply #4 on: September 20, 2009, 12:36:09 PM »
Yeah, I managed to do 1, but it seems no text editors that I've found can do 2.
Or rather, almost all text editors can change case when a word is already selected, some can find an all-uppercase word using the expression [{A-Z}]{2,100}, but none I've found can find words that are all-uppercase - and then change them automatically.
Not a big deal, I've got it almost there so will just do the case-changing manually. It'll be worth it to be able to use code replacement on all the players....
Thanks for your help.

Offline Ben Curtis

  • Member
  • **
  • Posts: 94
    • View Profile
    • Snappertalk blog
Re: Need to convert this list into Code Replacement acceptable format
« Reply #5 on: September 20, 2009, 12:49:52 PM »
One other question... is code-replacement case-sensitive? i.e. if my code-replacement file has AUS1, AUS2 etc but in the caption I use aus1, aus2, will it still work? Thanks...

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24731
    • View Profile
    • Camera Bits, Inc.
Re: Need to convert this list into Code Replacement acceptable format
« Reply #6 on: September 20, 2009, 03:52:03 PM »
Ben,

One other question... is code-replacement case-sensitive? i.e. if my code-replacement file has AUS1, AUS2 etc but in the caption I use aus1, aus2, will it still work? Thanks...

It is case-sensitive.

-Kirk

Offline Ben Curtis

  • Member
  • **
  • Posts: 94
    • View Profile
    • Snappertalk blog
Re: Need to convert this list into Code Replacement acceptable format
« Reply #7 on: September 20, 2009, 04:54:44 PM »
Just in case anyone is ever looking to do the same, I found a solution to changing words that are all in uppercase.
The Mac application TextSoap was able to find all words in uppercase and batch-change them to Titlecase.