E-mail pattern Was: Help on regex script..

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
But it isn't perfect and is a subject of many articles
See, for example:
http://www.regular-expressions.info/email.html

Valery

--- In [email protected], "valery_vi" <shehrer1@...> wrote:
>
> About e-mail. I found this nice pattern
> 
> $Pattern = '[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z](?i)'
> 
> $RegExResult = StringRegExp($array[1], $Pattern, 1)
> 
> It works with ARegExp script, too.
> 
> Valery
> 
> 
> --- In [email protected], "valery_vi" <shehrer1@> wrote:
> >
> > Florent,
> > 
> > I'm not expert in regexp but maybe it will be helpful to use 
regexp 
> > without grouping parenthethis '(...)'
> > 
> > > Column 1 :  9 numbers with first number = 1 (example : 
100000058)
> > $RegExResult = StringRegExp($array[1], '[1][0-9]{8}', 1)
> > > Column 2 : 10 numbers with first number = 0 (example : 
060254589)
> > > Column 3 : 10 numbers with first number = 0 (example : 
060254589)
> > $RegExResult = StringRegExp($array[1], '[0][0-9]{9}', 1)
> > 
> > > Column 4 : valid email address
> > It is expert's case.
> > ;-(
> > 
> > 
> > Valery
> > 
> > --- In [email protected], "Florent Gilain" 
> > <florent.gilain@> wrote:
> > >
> > > Hi all,
> > > 
> > > I have to create a script that will load a file containing 
lines 
> > separated
> > > by tabulation.
> > > Then, i need to verify data format using Regular expression; 
but 
> > i'm unable
> > > to understand how it works in AutoIT...i have read the help 
file 
> and
> > > tutorial, but it seems i missed something...
> > > 
> > > File would contain :
> > > 
> > > Column 1 :  9 numbers with first number = 1 (example : 
100000058)
> > > Column 2 : 10 numbers with first number = 0 (example : 
060254589)
> > > Column 3 : 10 numbers with first number = 0 (example : 
060254589)
> > > Column 4 : valid email address
> > > 
> > > Example of file containing data :
> > > 
> > > CODE_TIERS	TELEPHONE	GSM	EMAIL
> > > 100000002	0955480155	0906604855	me@ (valid line)
> > > 1000000042	0955480101	091242847
	himothercompany.com 
> > (invalid
> > > line)
> > > 
> > > 
> > > Here is what i have tryed :
> > > 
> > > $file = FileOpen("test.csv", 0)
> > > 
> > > ; Check if file opened for reading OK
> > > If $file = -1 Then
> > > 
> > > 	MsgBox(0, "Error", "Unable to open file.")
> > > 	Exit
> > > EndIf
> > > 
> > > $line_number = 0
> > > 
> > > ; Read in lines of text until the EOF is reached
> > > While 1
> > > 	$line = FileReadLine($file)
> > > 	If @error = -1 Then ExitLoop
> > > 	$line_number = $line_number+1
> > > 	MsgBox(0, "Line read :", $line)
> > > 
> > > 	$array = StringSplit($line, Chr(9), 1)
> > > 	MsgBox(0, "Line number " & $line_number & " / Column 1 :",
> > > $array[1])
> > > 	$RegExResult = StringRegExp($array[1], '([0]{1}[0-9]{8})', 1)
> > > 	If @error == 0 Then
> > >     MsgBox(0, "Line number " & $line_number & " / Column 1 : 
KO", 
> > $array[1])
> > > 	EndIf
> > > 	
> > > 	MsgBox(0, "Line number " & $line_number & " / Column 2 :",
> > > $array[2])
> > > 	$RegExResult = StringRegExp($array[2], '([0]{1}[0-9]{9})', 1)
> > > 	If @error == 0 Then
> > >     MsgBox(0, "Line number " & $line_number & " / Column 2 : 
KO", 
> > $array[2])
> > > 	EndIf
> > > 	
> > > 	MsgBox(0, "Line number " & $line_number & " / Column 3 :",
> > > $array[3])
> > > 	$RegExResult = StringRegExp($array[3], '([0]{1}[0-9]{9})', 1)
> > > 	If @error == 0 Then
> > >     MsgBox(0, "Line number " & $line_number & " / Column 3 : 
KO", 
> > $array[3])
> > > 	EndIf
> > > 	
> > > 	MsgBox(0, "Line number " & $line_number & " / Column 4 :",
> > > $array[4])
> > > 	$RegExResult = StringRegExp($array[4],
> > > '(^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?
[a-
> > zA-Z0-9]+)
> > > *)\.([A-Za-z]{2,})$)', 1)
> > > 	If @error == 0 Then
> > >     MsgBox(0, "Line number " & $line_number & " / Column 4 : 
KO", 
> > $array[4])
> > > 	EndIf
> > > 
> > > Wend
> > > 
> > > FileClose($file)
> > > 
> > > Any idea of what i missed ?
> > > 
> > > Thanks
> > > 
> > > Florent
> > >
> >
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.