• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regex.. why isn't this matching?  RSS feed

 
Brad Walton
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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 ]
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!