• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular Expresion Question - reluctant quantifier

 
Anu Charitha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,

I am java newbie preparing for scjp 5. I started my prep with K&B chap 6. I am at regex.



I am not able to figure out why this would not match any x's. Could anybody please clarify. Thanks for help.
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anu, welcome to javaranch.

Well when you use the *? reluctant quantifier, then as its name suggests, it will try to match as less as possible. This kind of things have been asked many times before. Maybe these few discussions might clear your doubt

http://www.coderanch.com/t/418121/Programmer-Certification-SCJP/certification/group-Matcher-class
http://www.coderanch.com/t/425642/Programmer-Certification-SCJP/certification/Pattern-Matching

If you still have doubts, then please ask...
 
Anu Charitha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit, now I know why x's are not being matched.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic