• Post Reply Bookmark Topic Watch Topic
  • New Topic

regex question.  RSS feed

 
jeroen dijkmeijer
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
g'day all!
I'm scanning a few header lines in a file for a DATE=\d+ and ROWS=\d+ occurence. I Use a bufferedReader to read the file line by line and then I try to match the line by


this fails to match on the line:

I found that the regex must match the whole line so

Does do the job, but this against my Perl5 experience and my Jakarta oro experience:

is matching according to perl rules (the '/' is for Perl5 compliance). Do I Need to include some flags? My whole regex responsible brain is freaking out.
Thanks in advance,
jeroen.
[ December 07, 2005: Message edited by: jeroen dijkmeijer ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should look at the difference between the find() and matches() methods in the Matcher class.
 
jeroen dijkmeijer
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allrighty!!
That explains a lot and did do the trick! Thanx!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!