Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Fórum regex only alphanumerics (except underscore)
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; // aljodav // http://rextester.com/users/376 namespace Rextester { public class Program { public static void Main(string[] args) { Match m1=Regex.Match("123ab456_",@"\W|_|^$"); bool onlyAlphaNumerics1=!m1.Success; // False Match m2=Regex.Match("123ab456@",@"\W|_|^$"); bool onlyAlphaNumerics2=!m2.Success; // False Match m3=Regex.Match("",@"\W|_|^$"); bool onlyAlphaNumerics3=!m3.Success; // False Match m4=Regex.Match("123ab456AB",@"\W|_|^$"); bool onlyAlphaNumerics4=!m4.Success; // True Console.WriteLine(onlyAlphaNumerics1); Console.WriteLine(onlyAlphaNumerics2); Console.WriteLine(onlyAlphaNumerics3); Console.WriteLine(onlyAlphaNumerics4); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Encrption & Decryption C#
Pizzas&Tuples&Golden-Medal
Обненник 24/7
Gerador de Matriz Data
Ex03 cm=ft,in
Test
SortedDictionary<TKey, TValue> クラス
Easter Holiday Calculator
sample
A
Please log in to post a comment.