I'm trying to extract the price using preg_match from the following

" Vehicle Details...Internet Price $ 19,155 Bodystyle"

I need the price only 19,155 but the value changes from each record so I just really need what's between $ and Bodystyle

Thanks!

    preg_match('#Internet Price \$ \K[^ ]+#', $string, $match);

      Thanks...that works but need a little more
      I'll get a little more specific, I don't think I gave quite enough info.

      I have a search function that stores results in $content see below...

      $content = $ossResults->getField($i, 'content', true);
      $subType = preg_replace('/[\/]+\//', '', $type);
      ?>
      <?php if ($type == 'text/html' && !empty($content)): ?>
      <li>
      <h2><?php echo $indice; ?>- <a href="<?php echo $url; ?>" target="_new"><?php echo $title; ?></a></h2>
      <div><?php echo $content; ?></div>
      <cite><?php echo $host; ?></cite>

      ----Basically it echos url, content, host and title all in a big block of text in a list.

      (1) I want to search through the $content and find "Internet Price $ 17,460 Bodystyle" every row has this exact line except number is different
      (2) I want to extract just the number (which varies) Ex $17,460.
      (3) Then echo that in another line and maybe format with Bold or a little html.

      Thanks I appreciate it.

        Couldn't you go with the specifics in the first post?
        What seemed to be an easy regex, now it's something that I hardly understand.
        Anyways, use this:

        preg_match_all('#Internet Price \$ (\d+,?\d+) Bodystyle#', $string, $match);
        // $match[1] is what you want
          Write a Reply...