|
You need to escape the '.' else it will match anything.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
That is true, too. You must also replace all the . with \.
So, the regex is "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5}$"
Take in mind that also the above regex is not absolutely correct. For example, it matches also 999.999.999.999:3000.
|
|
|
|
|
Mirko1980 wrote: "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5}$"
Thanks. It's working to check proper format of string.
Still I am working to check proper formt of string with correct ip address & port.
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
Try This :
System.Text.RegularExpressions.Regex regStr = new System.Text.RegularExpressions.Regex(@"^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}:[0-9]{1,5}$");
Thanks!
Develop2Program & Program2Develop
|
|
|
|
|
Wrong! Same mistake as Mirko1980.
Try 123a123a123a123, your regex will match that too!
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
But this work's fine.
MessageBox.Show(System.Text.RegularExpressions.Regex.IsMatch("123a123a123a123", @"^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}:[0-9]{1,5}$", System.Text.RegularExpressions.RegexOptions.ExplicitCapture).ToString());
Thanks!
Develop2Program & Program2Develop
|
|
|
|
|
Hmmmm not working for
2221.1.1:3000
Sorry!
Develop2Program & Program2Develop
|
|
|
|
|
Navneet Hegde wrote: Hmmmm not working for
2221.1.1:3000
Well, that is not suppose to work...
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Sorry make that 123a123a123a123:1
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
This should work
@"^[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[:][0-9]{1,5}$"
Thanks!
Develop2Program & Program2Develop
|
|
|
|
|
Navneet Hegde wrote: This should work
Rather use \. than [.] . Some regex implementations might see [.] as .
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Sure
thx!
Develop2Program & Program2Develop
|
|
|
|
|
I'd just try to open the port and let the framework figure it out.
|
|
|
|
|
PIEBALDconsult wrote: let the framework figure it out.
and miss all the fun regexing IPv6?
|
|
|
|
|
I'm more concerned about, "that which will come after IPv6".
Let Microsoft do all the work, that's why I pay them.
|
|
|
|
|
Another thread came up with:
@"^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}[:][0-9]{1,5}$"
But what if you want to constrain the octets to ONLY values from 0 to 255? And what if you really wanna go whole hog and constrain the port to 0 to 65535?
I don't know regular expressions that well, so I am curious.
Roink
Roink
|
|
|
|
|
Roink wrote: But what if you want to constrain the octets to ONLY values from 0 to 255? And what if you really wanna go whole hog and constrain the port to 0 to 65535?
Then you head over to www.regexplib.com and you do a search[^]
|
|
|
|
|
As they say in Britain, Brilliant! Everything a growing RegEx coder needs! Thank you! Muchas gracias! Merci beaucoup!
Roink
|
|
|
|
|
Roink wrote: As they say in Britain, Brilliant
I think they say that in other countries too, not just here in GB!
|
|
|
|
|
No, it's only there.
|
|
|
|
|
Roink,
Thanks for the solution.
Following is working to check proper ip & port. I found this from regexlib.com.
But still need to do varification for port as 0,00,000, etc or 0*.
<br />
@"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]):(\d{1,4}|[0-5]\d\d\d\d|[0-5]\d\d\d\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$"<br />
Thanks & Regards,
Aniket A. Salunkhe
modified on Wednesday, December 3, 2008 4:47 AM
|
|
|
|
|
Hi guys,
This is a quick question:
I was wondering if it's possible to remove that dotted border on a listview selected item, anyone knows how?
Sorry if I missed some simple thing :P
|
|
|
|
|
You can modify the list view by making is partially owner drawn.
You set the OwnerDraw property on the list view to true, then handle the various Draw events.
listView1.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(listView1_DrawColumnHeader);
listView1.DrawItem += new DrawListViewItemEventHandler(listView1_DrawItem);
listView1.DrawSubItem += new DrawListViewSubItemEventHandler(listView1_DrawSubItem);
void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
{
e.DrawDefault = true;
}
void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
e.DrawDefault = true;
}
void listView1_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
{
e.DrawDefault = true;
}
The events are triggered each time that part of the list view needs redrawing, and you just draw what ever you want onto the graphics object provided. You can call handy methods on the event args object like DrawText() to do the text drawing for you. Then all you do is leave out the focus rectangle, and if required, draw your own focus rectangle in the style you want.
You will need to check e.Item.Selected to see if the item being drawn is selected and if it needs a focus rectangle drawing or not.
Simon
|
|
|
|
|
I'm trying that now,
thanks alot for your quick answer.
|
|
|
|
|
|