Jump to content

String splitting query


lxndr

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.


Link to comment
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.
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.