need help on regex

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
i'm a newbie to regex....

i need to check if a given string has more than two occurences of . in the
begiining of string

for ex, if string has value .test is valid but ..test is invalid

Can you help me out with the pattern for such strings?
 
match patterns:

^[.]{2,}\w+
[if a given string has more than two occurences of [dot] .]

^[.]\w+
[if string has value .test is valid but ..test is invalid]

WBR, Alex Meleta
Blog:: devkids.blogspot.com



A> hi,
A> i'm a newbie to regex....
A> i need to check if a given string has more than two occurences of .
A> in the begiining of string
A>
A> for ex, if string has value .test is valid but ..test is invalid
A>
A> Can you help me out with the pattern for such strings?
A>
 
This would acheive the same thing, but without using regular expressions.

If String.StartsWith(".") = True And String.StartsWith("..") = False Then
'String starts with only one period.
Else
'String starts with no periods or starts with more than one period.
End If

- Andrew
 
I answered this in microsoft.public.dotnet.framework.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Back
Top