Sign in to follow this  
Followers 0
James

StringRegExp - @

11 posts in this topic

#1 ·  Posted (edited)

Hi all,

Just wanderning if there was anyway to regexp the '@' symbol. I have tried everything I can think of I just can't get there :)

So I found the ASCII code is 64, but how do I check agains the code?

James

Edited by JamesB

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You should just be able to slash-escape the @ symbol like:

\@

and put matching patterns around either side of it

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

What is the problem?

$Email = "somemail@gmail.com"

ConsoleWrite(StringRegExp($Email, "@"))oÝ÷ Øò¢ìÛhr'Þ¨¥ËÚ'méò¢ç붬jëh×6$Email = "mymail@gmail.com"
If _IsVailidEmail($Email) Then MsgBox(0, "Check Email", "<" & $Email & "> is vailid Email!")

Func _IsVailidEmail($sEmail)
    Return StringRegExp($sEmail, "^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|" & _
        "[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$")
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Doesn't work...

try this

$emailaddy="you@somedomain.com"

$email =StringRegExpReplace($emailaddy,"([^\@]+)\@[^\@]+","\1")
$domain=StringRegExpReplace($emailaddy,"[^\@]+\@([^\@]+)","\1")

$regexpEmailAddy=$email&'@'&$domain
If $emailaddy==$regexpEmailAddy Then
    MsgBox(0,'test passed','Email Account: '&$email&@CRLF&'Domain: '&$domain)
Else
    MsgBox(0,'test failed','Email Account: '&$email&@CRLF&'Domain: '&$domain)
EndIf

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Guess what ptrex. I have actually got all macros working correctly! Oh yeah!

// Macros
    {input : /@(Unicode|AppDataCommonDir|AppDataDir|AutoItExe|AutoItPID|AutoItUnicode|AutoItVersion|AutoItX64|CO


M_EventObj|CommonFilesDir|Compiled|ComputerName|ComSpec|ComSpec|CR|CRLF|CR|DesktopCommonDir|DesktopD


ir|DesktopHeight|DesktopWidth|DesktopDepth|DesktopRefresh|DocumentsCommonDir|error|exitCode|exitMeth


od|extended|FavoritesCommonDir|FavoritesDir|GUI_CtrlId|GUI_CtrlHandle|GUI_DragId|GUI_DragFile|GUI_Dr


opId|GUI_WinHandle|HomeDrive|HomePath|HomeDrive.|HomeShare|HOUR|HotKeyPressed|InetGetActive|InetGetB


ytesRead|IPAddress1|IPAddress2|IPAddress3|IPAddress4|KBLayout|LF|LogonDNSDomain|LogonDomain|LogonSer


ver|MDAY|MIN|MON|MyDocumentsDir|NumParams|OSBuild|OSLang|OSServicePack|OSTYPE|OSVersion|ProcessorArc


h|ProgramFilesDir|ProgramsCommonDir|ProgramsDir|ScriptDir|ScriptFullPath|ScriptDir|ScriptLineNumber|


ScriptName|SEC|StartMenuCommonDir|StartMenuDir|StartupCommonDir|StartupDir|SW_DISABLE|SW_ENABLE|SW_H


IDE|SW_LOCK|SW_MAXIMIZE|SW_MINIMIZE|SW_RESTORE|SW_SHOW|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMI


ZED|SW_SHOWMINNOACTIVE|SW_SHOWMINIMIZED|SW_SHOWNA|SW_SHOW|SW_SHOWNOACTIVATE|SW_SHOWNORMAL|SW_SHOWNOR


MAL|SW_UNLOCK|SystemDir|TAB|TempDir|TRAY_ID|TrayIconFlashing|TrayIconVisible|UserProfileDir|UserName


|WDAY|WindowsDir|WorkingDir|YDAY|YEAR)/gi, output : '<em>@$1</em>' },

Hehe, I am so good :)

Edited by JamesB

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