• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

greedy quantifier

 
Isaac Lee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following program :


I get the result like this:

0f
1


For the program below:



I get the result :
0f

I don't understand why the results are different. In my understanding, the first program should give the result 0f , the same as the second. why is it different?

Thanks.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check your private messages for an important administrative matter.
 
Henry Wong
author
Marshal
Pie
Posts: 21004
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the first case, the pattern is zero or one letter f. In the second case, the pattern is one or more letter f. It is the zero letter f part of the first pattern that allows the second match.

Henry
 
Isaac Lee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. Henry
 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Deleted entire post as "hi-jack." Original in our "deleted" forum. CR]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic