Charlotte Hee wrote:
> Hi Bob,
> 
> In one of my tests I added the '>' to the character class [^\w->] but
> I still didn't get 'B0->'. 

I'm guessing it's because that looks like a range. Using [^\w\->] should
work.

> I've just learned about character classes
> so I am trying to get a better handle on how they work. A lot of my
> titles contain physics terms like B0->K- and I would consider 'B0->'
> a word and 'K-' another word.

OK. Instead of using split, why not capture the tokens you're interested in.
Something like:

    for my $w ($title =~ /([A-Za-z]+[^A-Za-z\s]*)\s*/g) {

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to