Pulling a specific string from a file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • elyob

    Pulling a specific string from a file

    Hi, I'm looking at pulling a string from a source file and am wondering the
    best way to do this. I have a starter and ender quote but am just wondering
    the best way to do this? Regular expressions?

    Thanks


  • Erwin Moller

    #2
    Re: Pulling a specific string from a file

    elyob wrote:
    [color=blue]
    > Hi, I'm looking at pulling a string from a source file and am wondering
    > the best way to do this. I have a starter and ender quote but am just
    > wondering the best way to do this? Regular expressions?
    >
    > Thanks[/color]

    Easiest way without regexpr is using:
    substr()
    and
    strpos()

    Use strpos to find the position of the starterquote and also for endquote.
    Use substr to retrieve the part inbetween.

    check at www.php.net for usage.
    It is really very straightforward (when you know the functionnames. :P )

    Regards,
    Erwin Moller

    Comment

    • elyob

      #3
      Re: Pulling a specific string from a file


      "Erwin Moller"
      <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> wrote in
      message news:4396e821$0 $11071$e4fe514c @news.xs4all.nl ...[color=blue]
      > elyob wrote:
      >[color=green]
      >> Hi, I'm looking at pulling a string from a source file and am wondering
      >> the best way to do this. I have a starter and ender quote but am just
      >> wondering the best way to do this? Regular expressions?
      >>
      >> Thanks[/color]
      >
      > Easiest way without regexpr is using:
      > substr()
      > and
      > strpos()
      >
      > Use strpos to find the position of the starterquote and also for endquote.
      > Use substr to retrieve the part inbetween.
      >
      > check at www.php.net for usage.
      > It is really very straightforward (when you know the functionnames. :P )
      >[/color]

      Thanks, I just thought I'd try that before you posted, I've now got the
      string out succesfully! The strstr function was also very useful.

      Thanks


      Comment

      Working...