0
Why is this regex not working ?
I'm trying to use regex to output true if the string meets the requirements, but it keeps outputting false .Can someone please help me. https://code.sololearn.com/cx0q3osoWwrP/?ref=app
6 odpowiedzi
+ 3
It works if you correctly copy what I've done:
https://code.sololearn.com/cWs1P62ZIWX2/?ref=app
+ 3
Here's a solution using a single RegEx pattern.
I also include a set of positive and negative tests to ensure a variety of value samples for expected PASS / FAIL scenarios.
https://code.sololearn.com/c9VnW585YuDL/
+ 1
Not experiemenced at C#, but knowing regex: by correcting only all your regex, I get your expected True... but I don't know what are your exact requirements, so cannot be sure that all cases will be ok:
Regex Length = new Regex(@"^.{5,10}quot;);
Regex Number = new Regex(@"[0-9]");
Regex Specialchar = new Regex(@"[^£$]");
Regex nospace = new Regex(@"\S");
+ 1
Thank you visph.
+ 1
But you need to redo your regex study... at least try to understand why your regex didn't work as expected (you could log each by each result, rather than just checking all at once, to better see where there are problems ^^)
0
Sorry, visph it didn't work, but thank you.