How to import regex inside form in C#

Updated on November 11, 2017 in [C] Beginner
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
5 on November 8, 2017

Hi,

I was make form that contain (list box – text box & button) 

but I don’t know how to import regex code inside it.

using Visual Studio..

so, I hope you help me.

thanks

  • Liked by
Reply
1 on November 8, 2017
on November 8, 2017

I’m already see this page it’s talk about description methods, class…etc.

what I want is put regex code within form code, I’m a beginner in C# and enforcement all lessons in brackeys channel on youtube it’s great, I hope you make lessons on regex.

Show more replies
  • Liked by
Reply
Cancel
0 on November 10, 2017

How can I use this method: public bool IsMatch(string input, int startat)

like this one: 

using System;
using System.Text.RegularExpressions;
namespace RegExApplication {
class Program {
 private static void showMatch(string text, string expr) {
 Console.WriteLine("The Expression: " + expr);
 MatchCollection mc = Regex.Matches(text, expr);
 foreach (Match m in mc) {
 Console.WriteLine(m);
 }
 }
 static void Main(string[] args) {
 string str = "make maze and manage to measure it";
Console.WriteLine("Matching words start with 'm' and ends with 'e':");
 showMatch(str, @"\bm\S*e\b");
 Console.ReadKey();
 }
 }
}

 

 

this my code:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace RegExApplication
{
 class Program
 {
 private bool IsMatch(string input, int startat)
 {
 Console.WriteLine("The Expression: " + startat);
 MatchCollection mc = Regex.Matches(input, startat);
 foreach (Match m in mc)
 {
 Console.WriteLine(m);
 }
 }
 static void Main(string[] args)
 {
 startat = "user input";
 input = null;
 Console.WriteLine("Matching words that start with 'S': ");
 IsMatch(str, @"\bS\S*");
Console.ReadKey();
 }
 }
}

 

 

where would I learn regex on good way? Step By Step.

  • Liked by
Reply
Cancel
0 on November 10, 2017

Regular Expressions isn’t something just C# has, but there are more then enough resources to help you understand the regex pattern.

  • Liked by
Reply
Cancel
0 on November 11, 2017

ok, is (zedshow) book would be useful to people who want to learn regex on c#?
and any lessons of regex for other language, I can learn for c# too?

thank you very much (Job) for your help.

  • Liked by
Reply
Cancel