Jump to content


Photo

String splitting query


  • Please log in to reply
2 replies to this topic

#1 lxndr

lxndr
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 02 June 2006 - 11:43 AM

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.




#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 June 2006 - 11:49 AM

[!--quoteo(post=379296:date=Jun 2 2006, 11:43 AM:name=lxndr)--][div class=\'quotetop\']QUOTE(lxndr @ Jun 2 2006, 11:43 AM) View Post[/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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 lxndr

lxndr
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 02 June 2006 - 12:05 PM

[!--quoteo(post=379297:date=Jun 2 2006, 12:49 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 2 2006, 12:49 PM) View Post[/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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users