By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,872 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

understanding the '?' reg exp

P: 1
hi ,
what is the difference between the below two search patterns and why do they yield different results'.*@?','abc.def@com')=abc.def@com'.*f@?','abc.def@com')=abc.def@

Apr 10 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851
'.*@?' in effect is the same as '.*' because '?' tells the interpreter to match zero or one of the preceding expression, so the '*' matches to the end of the string and the '@?' matches nothing.

'.*f@' matches everything up to and including 'f@'.
Apr 10 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.