Re: problem with splitting on "words"

2004-07-30 Thread John W. Krahn
Charlotte Hee wrote: On Fri, 30 Jul 2004, Bob Showalter wrote: 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) { Let me see if I understand this expression: [snip] \s*/g This matches a blank space z

RE: problem with splitting on "words"

2004-07-30 Thread Bob Showalter
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

RE: problem with splitting on "words"

2004-07-30 Thread Charlotte Hee
On Fri, 30 Jul 2004, Bob Showalter wrote: > Date: Fri, 30 Jul 2004 13:52:57 -0400 > From: Bob Showalter <[EMAIL PROTECTED]> > To: 'Charlotte Hee' <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Subject: RE: problem with splitting on "words" > &g

RE: problem with splitting on "words"

2004-07-30 Thread Bob Showalter
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 handl

RE: problem with splitting on "words"

2004-07-30 Thread Charlotte Hee
;K- and I would consider 'B0->' a word and 'K-' another word. thanks for the quick repy. Chee On Fri, 30 Jul 2004, Bob Showalter wrote: > Date: Fri, 30 Jul 2004 13:29:54 -0400 > From: Bob Showalter <[EMAIL PROTECTED]> > To: 'Charlotte Hee&#x

RE: problem with splitting on "words"

2004-07-30 Thread Bob Showalter
Charlotte Hee wrote: > Hello All, > > I am having trouble splitting words from titles from a list of > research papers. I thought I could split the title into words like so: > > #!/usr/local/bin/perl > use locale; > > %forums = ( 1 => 'B0->K+K-Ks', > 2 => 'B+->K+KsKs Decays',

problem with splitting on "words"

2004-07-30 Thread Charlotte Hee
Hello All, I am having trouble splitting words from titles from a list of research papers. I thought I could split the title into words like so: #!/usr/local/bin/perl use locale; %forums = ( 1 => 'B0->K+K-Ks', 2 => 'B+->K+KsKs Decays', 3 => 'Measurement of the