Regex not working in asp.net(.aspx page)

Vicky

I have a regex thats working normally (when i tried through online regex checking websitesites). This should not allow 1234.1234.1234.1234 but while I am using it in asp.net,it is allowing even those values.

Any suggestion?

var ipfilter = new RegExp("(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?$)");
Wiktor Stribiżew

.NET regex differs from JavaScript one immensely. However, in this case, it is a regular problem: the dot must be preceded with a literal backslash, or placed inside a character class. I suggest the latter as it is less error-prone, and you need to add a ^ (start of string) anchor:

var rx = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.](25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.](25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.](25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?$)";

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Create a form on an ASPX page in asp.net

From Dev

ASP.NET: Call .swf in .aspx page

From Dev

Navigation is not working on aspx page

From Dev

Refresh aspx page in ASP.NET tab panel

From Dev

Integrating a ASP.NET (.aspx) page into a existing Lightswitch project

From Dev

Jqgrid with asp.net [WebMethod] inside aspx page Issue

From Dev

How to return response to .aspx page from Handler in asp.net

From Dev

ASP.net default login.aspx page missing images

From Dev

Refresh aspx page in ASP.NET tab panel

From Dev

OnClick events not working in ASP.NET page

From Dev

Login page not working in vb asp.net

From Dev

asp.net Custom error page not working

From Dev

HTTPS for only one ASP.NET page (Login.aspx), HTTP always for rest of site

From Dev

ASP.NET MVC4 with webforms Default.aspx as the start page

From Dev

ASP.NET - Hyperlink relative path to current URL on ASPX page not in code behind

From Dev

ASP.NET Web Application - publishing - not creating individual assembles (dlls) for each aspx page

From Dev

How to find user control kept inside another usercontrol from parent aspx page in asp.net?

From Dev

Find the Directory of folder in root from a aspx page which is inside a folder in asp.net

From Dev

Get user control element text from aspx page in asp.net

From Dev

Add an aspx page with code-behind to a compiled ASP.Net site

From Dev

Bind data and display datatable on aspx page using Jquery in asp.net on tbody

From Dev

ASP.NET Web Forms call embedded VB Code from another aspx. page

From Dev

Localization not working for all the Markup / Tags in ASPX page

From Dev

IE conditional comments not working in aspx page

From Dev

Regex For Finding ASP.Net page multiline comment

From Dev

json stringify not working on asp.net mvc page

From Dev

Static Html page is not working after hosting in ASP.NET MVC

From Dev

Preview to a particular page is not working in asp.net mvc 4

From Dev

Checkbox not working in asp.net and HTML mixed page

Related Related

  1. 1

    Create a form on an ASPX page in asp.net

  2. 2

    ASP.NET: Call .swf in .aspx page

  3. 3

    Navigation is not working on aspx page

  4. 4

    Refresh aspx page in ASP.NET tab panel

  5. 5

    Integrating a ASP.NET (.aspx) page into a existing Lightswitch project

  6. 6

    Jqgrid with asp.net [WebMethod] inside aspx page Issue

  7. 7

    How to return response to .aspx page from Handler in asp.net

  8. 8

    ASP.net default login.aspx page missing images

  9. 9

    Refresh aspx page in ASP.NET tab panel

  10. 10

    OnClick events not working in ASP.NET page

  11. 11

    Login page not working in vb asp.net

  12. 12

    asp.net Custom error page not working

  13. 13

    HTTPS for only one ASP.NET page (Login.aspx), HTTP always for rest of site

  14. 14

    ASP.NET MVC4 with webforms Default.aspx as the start page

  15. 15

    ASP.NET - Hyperlink relative path to current URL on ASPX page not in code behind

  16. 16

    ASP.NET Web Application - publishing - not creating individual assembles (dlls) for each aspx page

  17. 17

    How to find user control kept inside another usercontrol from parent aspx page in asp.net?

  18. 18

    Find the Directory of folder in root from a aspx page which is inside a folder in asp.net

  19. 19

    Get user control element text from aspx page in asp.net

  20. 20

    Add an aspx page with code-behind to a compiled ASP.Net site

  21. 21

    Bind data and display datatable on aspx page using Jquery in asp.net on tbody

  22. 22

    ASP.NET Web Forms call embedded VB Code from another aspx. page

  23. 23

    Localization not working for all the Markup / Tags in ASPX page

  24. 24

    IE conditional comments not working in aspx page

  25. 25

    Regex For Finding ASP.Net page multiline comment

  26. 26

    json stringify not working on asp.net mvc page

  27. 27

    Static Html page is not working after hosting in ASP.NET MVC

  28. 28

    Preview to a particular page is not working in asp.net mvc 4

  29. 29

    Checkbox not working in asp.net and HTML mixed page

HotTag

Archive