Sign in to follow this  
Followers 0
karliky

StringRegExp

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 you

You'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 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.

Share this post


Link to post
Share on other sites

Put a + after ]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0