Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of interval in python regular expression

Shulou Source: shulou.com Published: 2022-06-03 17:34:19 09月30日 Update

I would like to share with you the sample analysis of intervals in python regular expressions. I hope you will get something after reading this article. Let's discuss it together.

1. The regular expression engine uses a hyphen (-) to represent an interval in a character group, so you can use [0-9] to match any number.

If we want to match all lowercase letters, we can write [amurz] and all uppercase letters.

2. Intervals can also represent consecutive English alphabet character classes, or multiple different intervals.

Example

A = re.findall (r'[0-9]', 'xxx007abc') b = re.findall (r' [a murz]', 'abc001ABC') c = re.findall (r' [A-Za-z0-9]', 'abc007ABC') d = re.findall (r' [0-9\ -]', '0edu 007 muredu') print (a) print (b) print (c) print (d) finished reading this article I believe you have some understanding of "sample Analysis of intervals in python regular expressions". If you want to know more about it, please follow the industry information channel. Thank you for reading!

Tags: Regular expression interval letter center example analysis character article different representative multiple uppercase uppercase done instance lowercase engine number more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB OPPO Reno Redmi Microsoft