|
How can we write a regular expression which accepts only alphabets or digits or alphanumeric(alphabets+digits)
|
|
|
|
|
Usually with a text editor, but you could use Expresso[^].
|
|
|
|
|
i have written like this ^[A-Z0-9]$ is this valid?
|
|
|
|
|
Santhapur wrote: i have written like this ^[A-Z0-9]$ is this valid?
Yes, that is correct.
It can also be written ^[A-Z\d]$.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes, though you may want to change it to ^[A-Za-z0-9]$ to allow lower-case letters as well. If you want to allow more than one letter or digit in a match, add a + before the $so that the expression looks like this: ^[A-Za-z0-9]+$
If you're looking for some helpful .NET regex tools, I use the free Rad Software Regular Expression Designer[^] to help build and test regular expressions.
|
|
|
|
|
Seems like a very good tool. Thanks for the info!
Mika
|
|
|
|
|
|
leppie wrote: ^\w+$
As that doesn't do exactly what the OP asked for, perhaps you should have explained what it does...
It allows letters, digits and underscore, i.e. it's equivalent to ^[A-Za-z0-9_]+$.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
OK, I actually didn't know about the underscore Damn rusty brain
|
|
|
|
|
can be accessed a code written in C + + from a code written in C #. its possible.
thanks.
|
|
|
|
|
|
Hi,
What is the best way to display FAQ's in a windows application.
There is a way to connect to some web page on the web?
There is a way to open an offline web page?
Thanks,
|
|
|
|
|
lune12 wrote: What is the best way to display FAQ's in a windows application.
There is a way to connect to some web page on the web?
There is a way to open an offline web page?
Yes. Use the webbrowser control.
|
|
|
|
|
|
I need to check the whether the modem exists in the system how to do this in C#
|
|
|
|
|
You might want to use WMI - see this[^] article. They key you probably want is Win32_POTSModem and/or Win32_NetworkAdapter.
/ravi
|
|
|
|
|
hi,i'm using visual studio 2003 ( c# programming,.net 1.1)
i need check if a form in application is open or not,like application.openforms() in visual studio 2005
please help me ?
|
|
|
|
|
Why don't you declare that form global and check whether it is visible or not with "if (myForm2.Visible) "?
|
|
|
|
|
If you need just a single instance, use static variable or singleton.
If you need multiple instances:
- if they are MDI children, use Form.MdiChildren Property[^]
- otherwise use static list and add form to the list in constructor and remove it from the list in Form.Closed Event[^]
|
|
|
|
|
thank you for answer,but i have another question
for example i have 2 forms,in the first form i have a button that click this button the form2 has shown
but i need while form2 is show another form of form2 does'nt show!and if form2 is minimized and show when i click button windows sate of form2 was normal!
please help me ?
|
|
|
|
|
Hi i am inheriting two interfaces A, B which has a method with common name called codeproject. When i am trying to call that method which interface method does it call? or how can we call a patricular method.
interface A
{
public void codeproject();
}
interface B
{
public void codeproject();
}
public class code : A, B
{
}
code c = new code();
c.codeproject() // which method is it calling ? what do i need to do call a particular method?
Santhapur
|
|
|
|
|
neither as the codeproject method is implemented in the class, not the interface.
you can implement each interface explicitly if you wish by using
public class code : A, B
{
void A.codeproject()
{
}
void B.codeproject()
{
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
what if we call like
code c = new code();
c.Codeproject(); which one does it call?
|
|
|
|
|
I think you are misunderstanding interfaces. An interface has no implementation.
c.CodeProject simply calls the method CodeProject() in the class code - nothing is ever 'called' in an interface.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Ok Thanks I got you..
Santhapur
|
|
|
|