karliky Posted May 12, 2009 Share Posted May 12, 2009 Here is the code: #include <array.au3> $array = StringRegExp('sedfsdfsdsdfs wefweffwef wefwewef sfsdfsdfsdf sdfsdfsd@gmail.com wefrwerfwefew wefwefwefwef wefwefwefwef', '[a-z]@gmail.com', 1) _ArrayDisplay($array) I'm trying to extrac all *@gmail.com mails from the text. But the result from the code always is: d@gmail.com and not sdfsdfsd@gmail.com Help and thank you Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 12, 2009 Moderators Share Posted May 12, 2009 (edited) Here is the code: #include <array.au3> $array = StringRegExp('sedfsdfsdsdfs wefweffwef wefwewef sfsdfsdfsdf sdfsdfsd@gmail.com wefrwerfwefew wefwefwefwef wefwefwefwef', '[a-z]@gmail.com', 1) _ArrayDisplay($array) I'm trying to extrac all *@gmail.com mails from the text. But the result from the code always is: d@gmail.com and not sdfsdfsd@gmail.com Help and thank youYou're only telling it to get 1 [a-z]. Don't forget that emails can have other types of characters as well. #include <array.au3> Local $s_str = "sedfsdfsdsdfs wefweffwef wefwewef sfsdfsdfsdf sdfsdfsd@gmail.com wefrwerfwefew wefwefwefwef wefwefwefwef" Local $s_pattern = "((?i:[A-Z0-9\._%+-]+@gmail\.com))" Local $a_sre = StringRegExp($s_str, $s_pattern, 3) _ArrayDisplay($a_sre) Edited May 12, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
weaponx Posted May 12, 2009 Share Posted May 12, 2009 Put a + after ] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now