Hmm- nope, I didn't leave off the initial <?php. I've made that mistake before, and learned not to do it again.
Its not a deal now because I modified the above code to work in the place where I actually need it to. The actual variable I was using instead of $wTxt is a $_POST[] array member, and it seems to come with a \ inserted before every ", which was messing up the regex he used. I dumbed the regex down a bit (not a problem with the strings I should be getting) and it works great now.
Thanks again!
Edit- as a follow up, I must say, I'm confused by the pattern used in the above code. Based on the refrences I can find, I figured it would have a ^ at the start of the matched section, and a $ at the end, but when I use those I get errors like "No ending delimiter '' found".
Another instance I had trouble with was a fairly simple problem, but I couldn't find the pattern to do it based on any refrences I had.
preg_match_all('^<b>\w+</b>$',$_POST['wScene'],$CharNameMatch);
$CharName = $CharNameMatch[0][0];
$CharName = substr($CharName,3,-4);
What I WANT the above code to do is set $CharName to be the text (only) of the first piece of bolded text in an arbitrary block of html style code. I knew that there is something like <b>Name</b> in the stuff.
Looking at NogDog's code, I came up with the following, which works:
preg_match_all('/<b>\w+<\/b>/',$_POST['wScene'],$CharNameMatch);
$CharName = $CharNameMatch[0][0];
$CharName = substr($CharName,3,-4);
However, I have no idea WHY "/<b>\w+<\/b>/" is the pattern I should use. Well, I know the interiro stuff, but I don't see why there is a "/" at the start and end of it.