> solution here is to use negated classes to make the match. Negated
> Classes are not greedy they match untill an exception is made to the
> class and thats it. thus:

I think you're confused about what greedy means.

Negated classes (assuming you mean "[^x]") are neither greedy nor 
non-greedy.  The asterisk in "[^>]*" makes this greedy -- it will match 
as many characters as it can.  ".*" is no more or less greedy -- it 
matches as many characters as it can.  The difference is only in what is 
a legal match.  "." matches any character (except nulls in 
null-terminated strings), so it is more ... omnivorous?

Example:
"[^x]*a" (greedy) matching on "bad dog bad" will match "bad dog ba" 
since it finds the longest possible match (until the last a or it finds 
an x).
"[^x]*?a" (non-greedy or lazy) matching on the same string gives "ba" 
since it finds the shortest possible match.

Does that make sense?

--Ben


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:850
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to