Python Programming for Biology: Bioinformatics and Beyond



Download 7,75 Mb.
Pdf ko'rish
bet482/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   478   479   480   481   482   483   484   485   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

Regular expression codes

The  following  table  summarises  a  subset  of  the  code  syntaxes  which  have  special

meanings  within  regular  expression  specifications.  Note  that  regular  expressions  also

accept the escaped control characters which are present in general Python strings, such as

\n \r \t \ etc.

Regexp

code

Meaning

.

Matches any character, except newline (unless in flag=re.DOTALL



mode).

^

Matches the beginning of a string, or the beginning of a line if



flag=re.MULTILINE.

$

Matches the end of a string.



*

Requires zero or more matches.

+

Requires one or more matches.



?

Requires zero or one match.

*?, +?, ??

As above, but matching minimally (non-greedy) before the next

term.

{n}


Requires exactly n number or matches.


{min,max}

Requires between min and max matches, inclusive.

{min,max}?

As above, but matching minimally (non-greedy) before the next

term.

[abc]


Matches a set of explicit characters. Control codes like ‘.’ and ‘+’

are treated literally.

[a-e]

Matches a set made with a consecutive range of characters, from a



to e, inclusive.

May be combined with explicit characters.

[^abc]

Matches the inverse character set, i.e. if the character is not a, b or



c.

a|b


Matches either specification a or b.

(expression)

Captures part of a match as a group which may be recalled.

(?…)


An extended system allowing more complex rules.

See


http://www.python.org

for full documentation.

\1, \2, …

\99


Recalls the match from a numbered group.

Can be used to repeat a match or include group contents in a

substitution.

\A

Matches the beginning of a string.



\b

Matches a word boundary; between a word (\w) and non-word

(\W) character.

Used to match the edges of a word without specifying what’s

outside.

\B

Matches a non-word boundary.



\d

Matches digit characters.

Equivalent to the set [0-9].

\D

Matches non-digit characters.



\s

Matches whitespace characters.

Equivalent to the set [ \n\r\t\v\f].

\S

Matches non-whitespace characters.



\w

Matches alphanumeric characters and underscore (‘word’




characters).

Equivalent to the set [0-9a-zA-Z_].

\W

Matches non-word characters.



\Z

Matches the end of string.




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   478   479   480   481   482   483   484   485   ...   514




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