SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting part of a text column value

    I have built a site from an html model the client made but, now, they want some of the product description text displayed elsewhere and so I need to store it in a different column because its relationship is different.

    how should my query look to grab the text shown in capitals? it's always at the beginning of the text block and it may or may not be in the same paragraph. it may be one or more sentences. I just want the sentence(s) in capitals and their respective full stops/periods.


    LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT. DONEC PLACERAT, VELIT SIT AMET EGESTAS FRINGILLA, METUS TORTOR PORTA QUAM, AT DICTUM LEO ANTE ID LIBERO. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque id dui purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla pharetra aliquam sem, eu venenatis sapien fermentum ut. Mauris fringilla sagittis felis id tincidunt. Proin pellentesque iaculis pulvinar. Cras ut purus tellus, iaculis porta diam. Nulla tempus euismod fringilla. Ut quis elit sed leo pharetra feugiat. Nunc ultricies risus ut libero aliquam eleifend. Cras quis mollis tortor. Donec convallis bibendum ligula, nec pellentesque enim blandit sit amet. Nulla et purus id eros aliquet feugiat.


    This is disappointing me.

    Code MySQL:
    SELECT * 
    from product_range
    where description REGEXP '[[:upper:]]+';

    bazz

  2. #2
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I am not any further on with this.

    is there a way to search a text column taking the first part of the text as far along as a 'H. He' ie an UPPERCASE letter followed by a space, then a period and then an UPPERCASE letter followed immediately by a LOWERCASE letter?

    or am I best to bring in the whole paragraph and apply a regex?

    bazz

  3. #3
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh where's my brain gone?! I want to query my columns as a series of complete entities.
    (I hope that isn;t confusing).

    Amn't I correct that it is only the column I could query: I can't query a column and then return just some of its data?

    groan, I think that is correct.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •