in the given program, it is printing even the mail has got mailmail but, it has to be true only if it has only one gmail,or emali, or mail. after that it is also taking comcom inin but it has to print only it has one com or one in after the dot. ex : [email protected] #output : wrong mail [email protected] #output : wrong mail [email protected] #output : wrong mail [email protected] #output : right mail How Can We Do Like That? https://code.sololearn.com/c29lRf3Vv4J7/?ref=app
7/31/2020 4:27:43 AMMr. 12
3 AnswersNew Answer
Mr. 12 The reason things like mailmail and comcom are being matched is because of the "+" you put after the (mail|gmail...). The "+" means that 1 or more of that group (or whatever the "+" is acting on) can be matched. Really, the "+" doesn't need to be there (as maf 's code shows). Nice work though! 👍 Update: Also, you must change the square brackets to round, or else things like [email protected] will be matched. Characters in square brackets can appear in any order.
yes Russ , i have created another program after that which returns all the mailid's in a string or in a line. this program will return all the mailid's try this : tell me if you got any bugs. https://code.sololearn.com/cQQt0kqfHfiB/?ref=app https://code.sololearn.com/c67Qu4zkf2eu/?ref=app