Click here to Skip to main content
14,982,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please give me for c# launguage
(must be two words, uppercase, lowercase, space, and can contain the following chars ,/.- )

What I have tried:

I don't have any regex for this please help it is important to me
Posted
Updated 15-May-21 21:59pm

Try:
^([a-zA-z,/.-]+)\s([a-zA-z,/.-]+)$

But ... if you are going to use Regular expressions, get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.

And that probably won't do exactly what you want, since first names don't normally contain hyphens, and no names other than idiot "celebrities" have slashes, decimal points, or commas in either the first or last name ... and some of those have "one one name" anyway.
   
Comments
Chris Losinger 16-May-21 10:34am
   
'Griff, Original'

And clearly this is a homework assignment to test knowledge of regex escapes, not an actual first name tester.
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx: Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This site also show the Regex in a nice graph but can't test what match the RegEx: Regexper[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900