How the below mentioned quantifiers differ - with respect of scenarios,speed,etc.

  • ? v/s ?? v/s ?+ (1 or 0 times)

  • * v/s *? v/s *+ (0 or more times)

  • + v/s +? v/s ++ (1 or more times)

?,*,+ belongs to greedy

??,*?,+? belongs to reluctant

++,*+,,?+ belongs to possessive

can any one help me to understand,although each sets doing the same job in pattern matching cases, but still why such three are present in ruby for the same job?

Thanks

Again, someone has already answered this here. When you read, please read only the post with a green check mark on the left hand side. Don't need to read others' opinions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.