Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does [a-z0-9] mean?

Tags:

regex

I Have a Question. I'm just learning regular expressions in a python class and I do not understand what [a-z0-9] means. Can someone explain what each part means? I was on Google but I only confused myself.

like image 413
Ben Wang Avatar asked Sep 16 '16 02:09

Ben Wang


People also ask

What does a ZA Z0 9 mean in Java?

The bracketed characters [a-zA-Z0-9] mean that any letter (regardless of case) or digit will match. The * (asterisk) following the brackets indicates that the bracketed characters occur 0 or more times.

What does the A ZA Z0 9 +$/ regex check for?

[a-zA-Z0-9. _-:\?] means it can be among the all the Uppercase and lowercase letters and the number betwween 0 and 9, and the letter.

What is regex class 9?

A regular expression, also known as regex, is a pattern that represents a collection of strings that match the pattern. To put it another way, a regex only accepts a specific set of strings while rejecting all others.

What does Z mean in regex?

The subexpression/metacharacter “\Z” matches the end of the entire string except allowable final line terminator.


1 Answers

In a regular expression, if you have [a-z] then it matches any lowercase letter. [0-9] matches any digit. So if you have [a-z0-9], then it matches any lowercase letter or digit.

You can refer to the Python documentation for more information, especially in the chapter 6.2-Regular Expression operations

like image 118
Asct20 Avatar answered Sep 21 '22 23:09

Asct20