Jump to content

ingteractive

New Members
  • Posts

    2
  • Joined

  • Last visited

ingteractive's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Can anyone help me output "Zinfandel|Sauvignon Blanc" from "This very nice wine is produced in California and is made from Zinfandel and Sauvignon Blanc grapes."? Please also notice the case insensitivity. I prefer the output with capitals on first words. I created the following code : <?php $ds = "Riesling|Sauvignon Blanc|Zinfandel|Muscat/i"; $string = "This very nice wine is produced in California and is made from zinfandel and Sauvignon Blanc grapes."; echo "This is the string to extract the grapes from : "; echo $string; echo "<br>"; echo "These are the grapes that need to be matched in a regular expression : "; echo $ds; echo "<br>"; $matches = array(); $search = preg_match_all($ds, $string, $matches); foreach ($matches[1] as $match) { echo $match; // I want this to output "Zinfandel|Sauvignon Blanc" with a pipeline between the matches } ?> Any help pretty much appreaciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.