Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# regex number only

Regex

string input = "1-205-330-2342";
string result = Regex.Replace(input, @"[^d]", "");  //number only
Comment

c# regex number only

// for anynumber from zero to infinity
[RegularExpression("^[0-9]*$", ErrorMessage = "Enter Valid Number")] 

// for number greater than zero
[RegularExpression("^[1-9][0-9]*$", ErrorMessage = "Enter Valid Number")] 
Comment

regex only letters and numbers c#

Actually I found the issue, I was validating the string during the TextBox object's creation, instead of when it updates so there was no way for that code to be executed when it was needed. My bad
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to unfreeze a rotation in a collider unity 2d 
Csharp :: unity deadzone 
Csharp :: orderbyascending c# 
Csharp :: revitapi 
Csharp :: how to generate random letters in C# 
Csharp :: unity2d click on gameobject 
Csharp :: unity pause scene 
Csharp :: uuid generator asp.net 
Csharp :: remove element from sting array c# 
Csharp :: detect keypress c# 
Csharp :: c# loading assembly at runtime 
Csharp :: instantiate scale object 
Csharp :: save file dialog filter c# 
Csharp :: remove items from list c# condition 
Csharp :: how refresh just one table in laravel by terminal 
Csharp :: best practice c# check if string is null or whitespace 
Csharp :: c# and 
Csharp :: c# string to enum conversion 
Csharp :: west of loathing 
Csharp :: how to move mouse in c# 
Csharp :: tests not showing in test explorer 
Csharp :: small modal popup bootstrap 
Csharp :: c# unity get lines 
Csharp :: c# pick a random item from array 
Csharp :: photon rpc 
Csharp :: datagridview column color c# 
Csharp :: c# groupby date 
Csharp :: VLC .net 
Csharp :: how to make an object appear and disappear in unity 
Csharp :: swaggergen add service not getting info in .net core 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =