Note that there are some explanatory texts on larger screens.

plurals
  1. POHow is it possible to implement regular expressions (or the like) into WebMatrix razor C#?
    primarykey
    data
    text
    <p>I am trying to use regular expressions with my C# code, and I can find a few examples here on what those regular expressions might look like for my cause, but nowhere can I tell how I am supposed to (syntactically) implement that into my logic and code.</p> <p>I have tried setting up an external .cs file and then calling the method, but the value returned is unable to be casted or worked with in any way. The code can be found here:<a href="https://stackoverflow.com/questions/12899876/checking-strings-for-a-strong-enough-password">Checking strings for a strong enough password</a></p> <p>In any event, I just want to know how I can check (and test against) values in a password to make sure it is up to standards that I specify.</p> <p>A better way than suggesting to use regular expressions (since information on how to incorporate them into my own specific logistical setup is both very sparse and very confusing)</p> <p>...is suggesting how it can be done without them.</p> <p>I know I could use </p> <pre><code>foreach(char c in myString) </code></pre> <p>and then test individually, character by character, but I was hoping there was a better way that can either be regex, explained (that is, explained how to call this suggestion into action, not just posting a string of seemingly (but not) random characters and told, hey use that!), or not using regex at all, but somekind of shorthand, perhaps.</p> <p>Truth is I would use regular expressions, but every time I look them up I can't seem to find anything that is useable by me in WebMatrix.</p> <p>I want to be able to test a password to be sure that it has both an uppercase and a lowercase number. In addition I need to check for at least one number.</p> <p>UPDATE: Okay, allow me to rephrase my question, maybe I am being confusing...</p> <p>How does regex work in webmatrix razor (C#). Please show how the regex actually works (I can't seem to find a clear, or even close to clear, answer on this on the web for webmatrix), then please show how it can be put (directly or indirectly) into if logic, on my cshtml page, so that I can actually check against it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload