Jump to content

Archived

This topic is now archived and is closed to further replies.

lxndr

String splitting query

Recommended Posts

I have a series of song titles stored in an SQL database and want to be able to split one of the fields as follows:

before:

title: California, Here I Come (1924 version)
comment:


after:

title: California, Here I Come
comment: (1924 version)


So, what I need to be able to do is check if the title contains " version)" and if so I want to work out where the bracketed information starts and remove it from the song title (discarding the space before it) and place the bracketed information in another field. The bit I'm struggling with is determing where the bracketed information (containing the word 'version') starts because there could be other bracketed info in the song title too, e.g.:

California, Here I Come (1924 version) (worn)

or

California, Here I Come (worn) (1924 version)

Any help would be much appreciated.


Share this post


Link to post
Share on other sites
[!--quoteo(post=379296:date=Jun 2 2006, 11:43 AM:name=lxndr)--][div class=\'quotetop\']QUOTE(lxndr @ Jun 2 2006, 11:43 AM) [snapback]379296[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I have a series of song titles stored in an SQL database and want to be able to split one of the fields as follows:

before:

title: California, Here I Come (1924 version)
comment:
after:

title: California, Here I Come
comment: (1924 version)
So, what I need to be able to do is check if the title contains " version)" and if so I want to work out where the bracketed information starts and remove it from the song title (discarding the space before it) and place the bracketed information in another field. The bit I'm struggling with is determing where the bracketed information (containing the word 'version') starts because there could be other bracketed info in the song title too, e.g.:

California, Here I Come (1924 version) (worn)

or

California, Here I Come (worn) (1924 version)

Any help would be much appreciated.
[/quote]

wouldint be a lot easer to get rid of all brackets use str_repalce.

Share this post


Link to post
Share on other sites
[!--quoteo(post=379297:date=Jun 2 2006, 12:49 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 2 2006, 12:49 PM) [snapback]379297[/snapback][/div][div class=\'quotemain\'][!--quotec--]
wouldint be a lot easer to get rid of all brackets use str_repalce.
[/quote]
No, I need to do it the way I described.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.