Mine exploration, photographs and mining history for mine explorers, industrial archaeologists, researchers and historians Mine explorer and mining history videos on YouTube Connect with other mine explorers on Facebook
Tip: do not include 'mine' or 'quarry', search by name e.g. 'cwmorthin', use 'Sounds like search' if unsure of spelling

Advanced Search
'Sounds like search'
Quick a b c d e f g h i j k l m n o p q r s t u v w x y z
Tip: narrow down your search by typing more than one word and selecting 'Search for all words' or 'Exact search'

Search for any word
Search for all words
Exact search
Tip: narrow down your search by typing more than one word and selecting 'Search for all words' or 'Exact search'

Search for any word
Search for all words
Exact search

Mine Exploration Forum

Jump to page << < 1 2 > >>
Author Totally Off Topic - Regex
SimonRL

Avatar of SimonRL

Joined: 27/11/2005
Location: North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 10:02:13
Reply |  Quote
Completely off topic.

Is anybody on here a guru with RegEx (regular expressions)?

I'm having trouble with the one that validates the format of an email address (for the login on this web site). And I can't get my head around fixing the issue.

--

my orders are to sit here and watch the world go by
IP: 217.9.203.226
BertyBasset

Avatar of BertyBasset

Joined: 13/12/2007
Location: Caernarfon, North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 11:02:15
Reply |  Quote
We use the following - written by a colleague, so can't comment on any false positives etc.

^[^@ ]+@[^.@ ]+(\.[^.@ ]+)+$

Robin
IP: 217.9.203.195
SimonRL

Avatar of SimonRL

Joined: 27/11/2005
Location: North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 11:06:37
Reply |  Quote
Thank you Smile I'm using:

^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"

Which seems inordinately long in comparison. But so far I've had two complaints:

1, It didn't let through a + symbol in an email address prefix (you know who you are!)

2, It didn't let through a CompuServe email address in the format 12345.12345@compuserve.com

Looking at your example it looks as if it would pass those two. I'll give it a go...

--

my orders are to sit here and watch the world go by
IP: 217.9.203.226
SimonRL

Avatar of SimonRL

Joined: 27/11/2005
Location: North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 11:12:11
Reply |  Quote
That seems to work very nicely. Thank you. Flowers

--

my orders are to sit here and watch the world go by
IP: 217.9.203.226
sinker

Avatar of sinker

Joined: 13/12/2010
Location: North Wales.

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 11:30:53
Reply |  Quote
SimonRL wrote:



^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"





Blink

--

Ah, well, now, you see.... IP: 212.183.128.51
JohnnearCfon

Avatar of JohnnearCfon

Joined: 22/12/2005
Location: Sir Caernarfon

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 12:02:07
Reply |  Quote
sinker wrote:

SimonRL wrote:



^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"





Blink


Is that a new mine somewhere? ConfusedConfusedConfused

Let me guess, pot noodle?
IP: 92.3.0.106 Edited: 04/12/2015 12:03:01 by JohnnearCfon
skimble

Joined: 23/06/2008
Location: Gwynedd

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 12:02:58
Reply |  Quote
BertyBasset wrote:

We use the following - written by a colleague, so can't comment on any false positives etc.

^[^@ ]+@[^.@ ]+(\.[^.@ ]+)+$

&@!.* seems to be an acceptable address according to the above (or am I misreading it?).
Should the conditions for the domain name be tighter?
IP: 82.71.4.122
SimonRL

Avatar of SimonRL

Joined: 27/11/2005
Location: North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 12:08:45
Reply |  Quote
skimble wrote:

BertyBasset wrote:

We use the following - written by a colleague, so can't comment on any false positives etc.

^[^@ ]+@[^.@ ]+(\.[^.@ ]+)+$

&@!.* seems to be an acceptable address according to the above (or am I misreading it?).
Should the conditions for the domain name be tighter?


You're correct, it does let that through Crying

--

my orders are to sit here and watch the world go by
IP: 217.9.203.226
rufenig

Avatar of rufenig

Joined: 18/03/2008
Location: Shropshire Hills

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 12:28:48
Reply |  Quote
My brain hurts. Surrender IP: 146.199.27.227
ttxela

Avatar of ttxela

Joined: 04/09/2007
Location: Cambs

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 12:31:02
Reply |  Quote
Looks like the sort of thing characters in the Beano used to say when they dropped anvils on their foot. IP: 188.39.178.242
davel

Avatar of davel

Joined: 24/07/2007
Location: Gwynedd

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 13:20:17
Reply |  Quote
skimble wrote:

BertyBasset wrote:

We use the following - written by a colleague, so can't comment on any false positives etc.

^[^@ ]+@[^.@ ]+(\.[^.@ ]+)+$

&@!.* seems to be an acceptable address according to the above (or am I misreading it?).
Should the conditions for the domain name be tighter?


It's complicated ... Sad

See RFC 5321 and RFC 5322, and extensions like RFC 6531 etc. for more than you really want to know about email addresses. Confused

The simple case is that domain names should (generally) contain only the ASCII letters 'a' to 'z' (in a case-insensitive manner), the digits '0' to '9', and the hyphen ('-'), so in the example that skimble gives, the domain name !.* is not valid. (This simple specification does not allow for non-ASCII characters in domain names or non-latin scripts, both of which are permissible). Also, there are length limitations on the domain names parts and the overall length.

A more strict regex might be:

^[^@ ]+@[0-9A-Za-Z\-]{1,62}(\.[0-9A-Za-Z\-]{1,62})+$

In addition, the hostname (including dots) should not be more than 254 characters.

However, the above regex does not validate internationalized domain names such as üñîçøðé@üñîçøðé.com, literal IPv6 addresses such as user@[IPv6:2001:db8::1] or those in non-latin scripts (I leave those as an exercise for the reader Smile )

Dave
IP: 195.137.87.110 Edited: 04/12/2015 13:21:52 by davel
Willy Eckerslyke

Avatar of Willy Eckerslyke

Joined: 03/11/2011
Location: Anglesey

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 14:14:30
Reply |  Quote
One should, of course, remember that the reverse diagonal should be avoided unless preceded by a 3-character cyclical. Failure to observe this simple rule brings Moreton’s convention into play and there's no knowing where you'll end up! IP: 147.143.12.142
skimble

Joined: 23/06/2008
Location: Gwynedd

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 14:16:44
Reply |  Quote
Willy Eckerslyke wrote:

One should, of course, remember that the reverse diagonal should be avoided unless preceded by a 3-character cyclical. Failure to observe this simple rule brings Moreton’s convention into play and there's no knowing where you'll end up!

Mornington Crescent!
IP: 82.71.4.122
Willy Eckerslyke

Avatar of Willy Eckerslyke

Joined: 03/11/2011
Location: Anglesey

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 14:22:31
Reply |  Quote
skimble wrote:

Mornington Crescent!

Blimey, that was quick! Thumbs Up
IP: 147.143.12.142
exspelio

Joined: 02/05/2012
Location: peak district

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 14:30:28
Reply |  Quote
rufenig wrote:

My brain hurts. Surrender


Mine too --- AAARGH---ShockedShocked

--

Always remember, nature is in charge, get it wrong and it is you who suffers!.
IP: 86.142.153.16
BertyBasset

Avatar of BertyBasset

Joined: 13/12/2007
Location: Caernarfon, North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 14:32:04
Reply |  Quote
Mine too

Repetition! - oops, wrong game.
IP: 217.9.203.195
Digit

Avatar of Digit

Joined: 29/07/2009
Location: North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 15:37:50
Reply |  Quote
JohnnearCfon wrote:

sinker wrote:

SimonRL wrote:



^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"




Blink



Is that a new mine somewhere? ConfusedConfusedConfused

Let me guess, pot noodle?


Actually its the Midnight Oil Well.

--

~~~ The future is not what it used to be ~~~
IP: 92.3.1.183 Edited: 04/12/2015 15:38:57 by Digit
ebgb

Joined: 07/05/2012
Location: weardale

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 17:00:05
Reply |  Quote
if you come over from the dark side I've a few neat php routines I've put together over the years that are pretty robust for fishing through strings in an email address


--

mid life crisis? buy an 80 year old wooden trawler!- http://bf494.co.uk
IP: 92.27.11.9
SimonRL

Avatar of SimonRL

Joined: 27/11/2005
Location: North Wales

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 17:12:39
Reply |  Quote
ebgb wrote:

if you come over from the dark side I've a few neat php routines I've put together over the years that are pretty robust for fishing through strings in an email address


Recoding the entire site in PHP would be a bit of an undertaking Laugh

--

my orders are to sit here and watch the world go by
IP: 217.9.203.226
TwllMawr

Avatar of TwllMawr

Joined: 28/11/2014
Location: Snowdonia

View Profile
View Posts
View Personal Album
View Personal Files
View all Photos
Send Private Message
Totally Off Topic - Regex
Posted: 04/12/2015 17:29:20
Reply |  Quote
426c6f6f647920736f66747761726520656e67696e65657273203a2d29

--

'Nitrate of Ammonium: If not too generously applied these explosives make an excellent manure' IP: 92.13.148.121
Jump to page << < 1 2 > >>
Safety LED Miners Caplamps Moore Books: Specialist Books I.A. Recordings: Mining and Industrial History DVDs Starless River - Caving Store Explore a Disused Welsh Slate Mine
Disclaimer: Mine exploring can be quite dangerous, but then again it can be alright, it all depends on the weather. Please read the proper disclaimer.
© 2005 to 2015 AditNow.co.uk
Top of Page