473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

understanding the '?' reg exp

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

owaiskhan
Apr 10 '11 #1
1 1467
bvdet
2,851 Expert Mod 2GB
'.*@?' 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

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

Similar topics

3
by: Ajith Prasad | last post by:
I would appreciate advice on how best to formulate the following problem in Python. I have originally posted the problem to the J Programming forum and received a one-line formulation ((#s)...
2
by: Thomas Weholt | last post by:
Hi, I want to add methods to a class instance at run-time based on a base method, but modify one of the existing ( or add if possible ) params of the base method. Say a class like this : ...
2
by: Oplec | last post by:
Hello, I am learning C++ using The C++ Programming : Special Edition by Bjarne Stroustrup. After reading some of his papers on his site, I came across a source code file that is used to compare...
5
by: Christopher Benson-Manica | last post by:
I'm trying to dynamically change the contents of a select box by doing the following... function myfunc() { var obj=document.getElementById("objname"); // name of the select box var str='';...
81
by: Jonas Smithson | last post by:
I recently read the claim somewhere that numerical entities (such as —) have a speed advantage over the equivalent named entities (such as —) because the numerical entity requires just a...
8
by: Flare | last post by:
Hi Im coming from a J2EE world and have used Hibernate very succesfully. Now I have to choose wich O/R mapping to use in my next ASP.NET project for the persistence layer. The next projet is...
1
by: Alex Sedow | last post by:
Where to get/buy tool for partial preprocessing? 1. What I mean by partial macro preprocessing. This is mode in which almost sources (>99%) is not preprocessed. But some macros (setted by...
50
by: Philipp Lenssen | last post by:
A nice way to dynamically update HTML on a page (without leaving the page) is to use document.innerHTML and XMLHTTP in JavaScript, then communicate with the server via XML snippets (plus some...
5
by: Turner | last post by:
Hi there! I havent done anything in html for a while, about a few months ago, I had started working with layers, mainly just to have a background image that would not repeat over and over. I...
3
by: gemel | last post by:
I am fairly comfortable with much of the .NET Exception mechanism, but I'm a bit unsure of some areas. 1. When an exception occurs and the exception is not caught then Exception processing will...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.