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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Regex help needed 1
Regex question 1
Regex Pattern 11
Regex help 8
regex help 1
Newbie question about Regex 8
Insert character using Regex 4
Regex - NewLine 3

Back
Top