About the Tutorial


Regular Expression Examples



Download 2,85 Mb.
Pdf ko'rish
bet231/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   226   227   228   229   230   231   232   233   234
Bog'liq
python3 tutorial 060821094426

Regular Expression Examples 
Literal characters 
Example 
Description 
python 
Match "python". 


Python 3 
354 
Character classes 
Example 
Description 
[Pp]ython 
Match "Python" or "python" 
rub[ye] 
Match "ruby" or "rube" 
[aeiou] 
Match any one lowercase vowel 
[0-9] 
Match any digit; same as [0123456789] 
[a-z] 
Match any lowercase ASCII letter 
[A-Z] 
Match any uppercase ASCII letter 
[a-zA-Z0-9] 
Match any of the above 
[^aeiou] 
Match anything other than a lowercase vowel 
[^0-9] 
Match anything other than a digit 
Special Character Classes 
Example 
Description 

Match any character except newline 
\d 
Match a digit: [0-9] 
\D 
Match a nondigit: [^0-9] 
\s 
Match a whitespace character: [ \t\r\n\f] 
\S 
Match nonwhitespace: [^ \t\r\n\f] 
\w 
Match a single word character: [A-Za-z0-9_] 
\W 
Match a nonword character: [^A-Za-z0-9_] 


Python 3 
355 
Repetition Cases 
Example 
Description 
ruby? 
Match "rub" or "ruby": the y is optional 
ruby* 
Match "rub" plus 0 or more ys 
ruby+ 
Match "rub" plus 1 or more ys 
\d{3} 
Match exactly 3 digits 
\d{3,} 
Match 3 or more digits 
\d{3,5} 
Match 3, 4, or 5 digits 
Nongreedy Repetition 
This matches the smallest number of repetitions- 
Example 
Description 
<.*> 
Greedy repetition: matches "
perl>" 
<.*?> 
Nongreedy: matches "
" in "
perl>" 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   226   227   228   229   230   231   232   233   234




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish