PDA

View Full Version : regex help


vern
09-30-2005, 02:53 AM
I'm totally stupid with regex. I just want to get the string that is between two words ... "bla" and "woha". How would I go about that?

missing-score
09-30-2005, 03:20 AM
If its always going to be those two words, try:

<?php
$word = preg_replace('/bla\s(.+?)\swoha/is', "$2", 'bla yaks woah');
?>

vern
09-30-2005, 03:52 AM
Hmmm ... I think the correct question is

just want to get the string that is between a character and a word ... "(" and "County". How would I go about that? I want to use something like ereg or ereg_replace.