'regex that check the validate of a string

I m looking a regex that checks if the string is valid or not.

The regex has the following rules :

  1. Is not allowed that the string begins with the char *
  2. The string has to begin with a char
  3. The string could have a special char after a normal char(for example: a**g***)

Actually this is my regex :

^(?!(\w.*?\\w.*){3}|\w.*? |\*$)\w.*?.*

Somebody can help me?



Solution 1:[1]

What do you mean by char? every character is a char!

If by char, you just mean everything except * you can use this: /^[^\*].*$/

If by char, you mean any alphanemeric value you can try: /^\w.*$/

If by char, you mean just alphabetic charachters: /^[a-zA-Z].*$/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mahdi Aryayi