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 :: c# tell if a class is a child or the class itself 
Csharp :: c# get file author 
Csharp :: discord embeds how to separate inline fields 
Csharp :: Unity upload image to project 
Csharp :: c# convert excel column index to letter 
Csharp :: serial begin 
Csharp :: c# how to get a file path from user 
Csharp :: c# multiple inheritance 
Csharp :: caesar cipher in C# 
Csharp :: Response.Redirect cannot be called in a Page callback 
Csharp :: c# listview add items horizontally 
Csharp :: factorial of number 
Csharp :: add header in action asp.net mvc 
Csharp :: unity script template folder 
Csharp :: c# slice array 
Csharp :: trygetvalue c# 
Csharp :: long string c# 
Csharp :: c# datediff 
Csharp :: instantiate c# 
Csharp :: catch multiple exception c# 
Csharp :: Default property value in C# 
Csharp :: asp.net web forms 
Csharp :: unity read console log 
Csharp :: c# delete object 
Csharp :: c# int to short 
Csharp :: dotnet core clickable row 
Csharp :: How do I identify the referrer page in ASP.NET? 
Csharp :: insert button in c# 
Csharp :: how to get point of collision in unity 
Csharp :: Make Enemy follow and rotate towards target in Unity 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =