-6

I am really newbie at RegExp's and I can't build it right now, so I've reffered to Stack Overflow.

Rules:

  1. Can contains from 6 up to 15 symbols
  2. Symbols can be latin letters, numbers, underline charachter.
  3. Nickname must begin from letter

I don't know how to make this regular expression. I need to use it in Javascript and PHP, so I need solution for each platforms.

4

2 に答える 2

6

これは開始するためのものですが、微調整して必要なものに適応させる必要があります。

[a-zA-Z]\w{5,14}
^       ^
|       match an alphanumeric or underscore character 5 to 14 times
|
match a single alphabetic character
于 2012-06-26T19:20:17.980 に答える
1

以下を使用できます。

/^[A-Za-z][A-Za-z0-9_]{5,14}$/

PHP と JS の両方で動作するはずです。

于 2012-06-26T19:20:21.500 に答える