Charlotte Hee wrote: > On Fri, 30 Jul 2004, Bob Showalter wrote: > > for my $w ($title =~ /([A-Za-z]+[^A-Za-z\s]*)\s*/g) { > > > > That's amazing! Yes, that works. > > Let me see if I understand this expression: > /([A-Za-z]+ > This matches any letter, uppercase or lowercase, 1 or more times.
Yes. A token needs to start with a letter. > > [^A-Za-z\s]*) > This matches anything that's not a letter, uppercase or lowercase, or > a space, zero or more times. Here is how I will match my '->'. Right. And it will stop at the next letter or whitespace char. > > \s*/g > This matches a blank space zero or more times and the 'g' means apply > the whole thing globally. > > But why do I need the character classes in parentheses? I did that so as not to capture the whitespace. Actually, I don't think you need it; try leaving it out. I'm not the strongest on regexes; other folks can probably improve on my approach here... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>