c# - Alphanumeric not working with underscore -


I am using the following REGEX and what I need, only accept the following uncounted alphanumeric values ​​

  1. should not start with the number 2. Accept the underscores between the character 3. The value may be after the value   

For example

aa_bb a1_a2

I tried with the following which is not working well:

  @ "^ [a-zA-Z0 - 9] + (_ [A-zA-Z0- 9] +] * $ ",    

  @ "^ [A-zA-Z] [a-zA-Z0- 9 _.] + \ S? $"   

Use this regex. < P> There are many flaws in your regex

  • ^ [a-zA-Z0- 9] + will allow numbers to begin the test string.
  • There is no space in the end so it will not allow space.

    Demo here:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -