1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2009
    Rep Power

    Php extract substring from between single quote marks

    Hi, I'm sure this is very simple, but I'm afraid I've had a look around and can't find the answer so I was hoping someone here could help.

    I have a string

    "'The name' and a bit of description"

    which I am pulling from a mysql query. I want to extract:

    The name

    using php. I'm sure it's a simple regular expression, but can't work it out, could someone help me out?

    Many thanks!
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    USA (verifiably)
    Rep Power
    Try using this expression:
    P.S. Why did you post this in the web design forum? (I already moved it to the Regex forum.)
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo