Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimum 6 characters regex expression [closed]

Tags:

regex

I m looking for regex which checks for at least 6 characters, regardless of which type of character.

like image 748
Mehmet Avatar asked Jul 02 '10 14:07

Mehmet


People also ask

How do you restrict length in regex?

The ‹ ^ › and ‹ $ › anchors ensure that the regex matches the entire subject string; otherwise, it could match 10 characters within longer text. The ‹ [A-Z] › character class matches any single uppercase character from A to Z, and the interval quantifier ‹ {1,10} › repeats the character class from 1 to 10 times.

What does '$' mean in regex?

Literal Characters and Sequences For instance, you might need to search for a dollar sign ("$") as part of a price list, or in a computer program as part of a variable name. Since the dollar sign is a metacharacter which means "end of line" in regex, you must escape it with a backslash to use it literally.

What does regex 0 * 1 * 0 * 1 * Mean?

Basically (0+1)* mathes any sequence of ones and zeroes. So, in your example (0+1)*1(0+1)* should match any sequence that has 1. It would not match 000 , but it would match 010 , 1 , 111 etc. (0+1) means 0 OR 1.

What is the minimum character length of a regex?

Regex: minimum 6 characters 2 digits and 1 special character. Please Sign up or sign in to vote. 0.00/5 (No votes) See more: C#. Need regular expression to check the password policy. and the password policy should : length of password :minimum 6 letters. 2 digits.

How long can text be in a regular expression?

The following regular expression ensures that text is between 1 and 10 characters long, and additionally limits the text to the uppercase letters A–Z. You can modify the regular expression to allow any minimum or maximum text length, or allow characters other than A–Z.

What characters does the regex ‹\W� match?

In Java 4 to 6, JavaScript, PCRE, Python 2.x, and Ruby, the word character token ‹\w› in this regex will match only the ASCII characters A–Z, a–z, 0–9, and _, and therefore this cannot correctly count words that contain non-ASCII letters and numbers.

How do I use the second regex in JavaScript without xregexp?

Standard JavaScript without XRegExp doesn’t have a “dot matches line breaks” option, so the second regex uses a character class that matches any character. See Any character including line breaks for more information. The following regex matches any string that contains between 10 and 100 nonwhitespace characters:


2 Answers

This match 6 or more any chars but newline:

/^.{6,}$/ 
like image 195
Toto Avatar answered Sep 19 '22 17:09

Toto


If I understand correctly, you need a regex statement that checks for at least 6 characters (letters & numbers)?

/[0-9a-zA-Z]{6,}/ 
like image 27
xil3 Avatar answered Sep 23 '22 17:09

xil3