Jump to content

StringRegExp


Recommended Posts

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

  • Moderators

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...