• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regex.. why isn't this matching?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't figure out why this isn't matching. It looks ok to me, and works fine when I test in Perl.



Thanks for any help.

Edit: Should have mentioned, I am trying to match on the data between \t and \n.
[ March 06, 2008: Message edited by: Brad Walton ]
 
Master Rancher
Posts: 4806
72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using m.find() instead of m.matches(). Find looks for your pattern anywhere within the input string, while matches() only looks to see if it matches the entire string, from beginning to end.
 
Brad Walton
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ehh.. nevermind. Should have been m.find(), not m.matches(). I think it's time to put the keyboard away for the day.

Edit: Thanks Mike, I found the problem and was typing this as you were typing I guess.
[ March 06, 2008: Message edited by: Brad Walton ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic