Help with this reg. exp. in PHP
- by Jonathan
Hi, i don't know about regular expressions, I asked here for one that:
gets either anything up to the first parenthesis/colon or the first word inside the first parenthesis. This was the answer:
preg_match('/(?:^[^(:]+|(?<=^\\()[^\\s)]+)/', $var, $match);
I need an improvement, I need to get either anything up to the first parenthesis/colon/quotation marks or the first word inside the first parenthesis.
So if I have something like:
$var = 'story "The Town in Hell"s Backyard'; // I get this: $match = 'story';
$var = "screenplay (based on)"; // I get this: $match = 'screenplay';
$var = "(play)"; // I get this: $match = 'play';
$var = "original screen"; // I get this: $match = 'original screen';
Thanks!