+ 1
I have many emails and i want to extract the emails wich username start with A or a and finish with r or R and .........
and it doesnt matter wich email i will extract....i only want to extract emails wich username start with A or a and finish with r or R Whether it's Yahoo or Facebook or any comany and whether the email end with .com or .net or .org or any thing so i wrote this code and it doesnt work....why? can any one correct it for me?? https://code.sololearn.com/ckLHS4aV32IN/?ref=app
6 Réponses
+ 7
This one should find all o...r@ patterns, but you need to delete the spaces inside the regex.
The problem is, though, that consecutive emails have no precise ending, unless you are sure they are always beginning with the capital letter, so you can use it as a rule.
+ 7
Omar o \w represents a "word" character, so any of the a-z, A-Z, 0-9 ranges or an underscore (no spaces!). There are only two strings meeting that criteria and so they are returned.
+ 4
That's because .+ is greedy and looks for the longest expression meeting the criteria without distinguishing between actual characters. And so the longest possible is the whole string from Om |ar@ until Amer| @gmail.com
0
Kuba Siekierzyński
ok but now i was editing the code and i could reach the emails wich i want by this code
https://code.sololearn.com/cxtq7wg9BU8T/?ref=app
but in this code👇i but .+ instead of \w
and it doesnt works.why??
https://code.sololearn.com/cxTEjB9Wty3x/?ref=app
0
Kuba Siekierzyński
but why \w isnot greedy like .+ ?
0
Kuba Siekierzyński thanks alot☺