|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Regular ExpressionI am trying to validate a textbox in which the user enters the following -
"smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I have tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. Does anyone have any idea how to validate this string. VB2005 "Ben" <B**@discussions.microsoft.com> wrote in message You might consider a tutorial such as these...news:6E18AFDE-5A22-4471-97C5-EF4274BFD47F@microsoft.com... >I am trying to validate a textbox in which the user enters the following - > "smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I > have > tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. > Does > anyone have any idea how to validate this string. > VB2005 > http://www.grymoire.com/Unix/Regular.html http://www.zvon.org/other/PerlTutorial/Output/contents.html "Ben" <B**@discussions.microsoft.com> wrote in message What if it is smtp.servername.bc.ca or similar? You don't get those?news:6E18AFDE-5A22-4471-97C5-EF4274BFD47F@microsoft.com... > I am trying to validate a textbox in which the user enters the following - > "smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I > have > tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. > Does > anyone have any idea how to validate this string. > VB2005
Show quote
Hide quote
On Sun, 30 Apr 2006 18:41:53 GMT, "Homer J Simpson" <nob***@nowhere.com> Or something like localhost or mymailcomuter.myinternaldomainwrote: > >"Ben" <B**@discussions.microsoft.com> wrote in message >news:6E18AFDE-5A22-4471-97C5-EF4274BFD47F@microsoft.com... >> I am trying to validate a textbox in which the user enters the following - >> "smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I >> have >> tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. >> Does >> anyone have any idea how to validate this string. >> VB2005 > >What if it is smtp.servername.bc.ca or similar? You don't get those? > > Ben wrote:
> I am trying to validate a textbox in which the user enters the following - Use something like:> "smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I have > tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. Does > anyone have any idea how to validate this string. > VB2005 > "(\w+\.){2,3}\w+" On 2006-04-30, Göran Andersson <gu***@guffa.com> wrote:
> Ben wrote: Don't forget hyphen...>> I am trying to validate a textbox in which the user enters the following - >> "smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I have >> tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. Does >> anyone have any idea how to validate this string. >> VB2005 >> > > Use something like: > > "(\w+\.){2,3}\w+" ([-\w]+\.)+[-\w]+ OK, I spose that should really be... (\w+([-\w]+)*\w\.)+(\w+([-\w]+)*\w) That middle '+' should be a star if we want to match on the local domain, though. Beyond just ensuring it's a valid DNS hostname, I'm not sure if the OP really has additional constraints or if the question is just poorly worded, so I'm assuming we're just looking for well-formed names. Thanks to all of you. and Thanks for the website with the tutorials.
Thanks Show quoteHide quote "david" wrote: > On 2006-04-30, Göran Andersson <gu***@guffa.com> wrote: > > Ben wrote: > >> I am trying to validate a textbox in which the user enters the following - > >> "smtp.servername.com or .net or .org or .com.uk etc... and I cannot. I have > >> tried. The string is in the form xxxxx.xxxxxxx.xxx or xxxx.xxxxx.xxx.xx. Does > >> anyone have any idea how to validate this string. > >> VB2005 > >> > > > > Use something like: > > > > "(\w+\.){2,3}\w+" > > Don't forget hyphen... > > ([-\w]+\.)+[-\w]+ > > > OK, I spose that should really be... > (\w+([-\w]+)*\w\.)+(\w+([-\w]+)*\w) > > That middle '+' should be a star if we want to match on the local > domain, though. > > Beyond just ensuring it's a valid DNS hostname, I'm not sure if the OP > really has additional constraints or if the question is just poorly > worded, so I'm assuming we're just looking for well-formed names. > >
Loading controls with objects versus recordsets
DataTable Loop and String Building TAG Property Is there an easy way to get my Subnet Mask? VB 2005 express database problems Ent Library. Substitute data from app.config? DATAGRID PROBLEM problem opening Excel file with Shell Displaying copied file names in textbox MailMessage to send email with both Text and HTML versions... |
|||||||||||||||||||||||