http://www1.nttu.edu.tw/klou/course/921/js/09-regular.htm
2. 程式碼練習
using System; using System.Text.RegularExpressions; public class Program { public static void Main() { string input = "%abqw-_1"; string pattern = @"^[a-z0-9-_%]*$";(表示開頭(^)到結尾($)可以是比對到多次的a-z或0-9或一槓(-)或底線(_) 或百分比(%)) foreach (Match match in Regex.Matches(input, pattern)) Console.WriteLine(match.Value); } }
3. 練習教程
https://www.runoob.com/csharp/csharp-regular-expressions.html
沒有留言:
張貼留言