In the previous study of the comparison of multi-mode, there are forward search, there are back-to-search, there is a positive pattern, there is a negative mode. This time to learn one, is the post-search affirmation mode, meaning that has been scanned the string, but also want to regret to see if you can match. Its syntax is: (? <=pattern). The example below is used to identify the Twitter account, but it will only match and not appear in the matching string, as follows:
[Python] View plain copy
#python 3.6
#蔡军生
#http://blog.csdn.net/caimouse/article/details/51749579
#
Import re
twitter = Re.compile (
‘‘‘‘‘
# A Twitter handle: @username
(? <[email protected])
([\w\d_]+) # username
‘‘‘,
Re. VERBOSE)
Text = "" This text includes the other Twitter handles.
One for @caimouse, and one for the author, @caijunsheng.
‘‘‘
Print (text)
For match in Twitter.findall (text):
Print (' Handle: ', match)
The resulting output is as follows:
This text includes the Twitter handles.
One for @caimouse, and one for the author, @caijunsheng.
Handle:caimouse
Handle:caijunsheng
In layman NumPy
http://edu.csdn.net/course/detail/6149
Getting started with Python game development
http://edu.csdn.net/course/detail/5690
You can do it. Modify the C compiler
http://edu.csdn.net/course/detail/5582
Card Game development
http://edu.csdn.net/course/detail/5538
Gobang Game Development
http://edu.csdn.net/course/detail/5487
RPG games from beginner to proficient
http://edu.csdn.net/course/detail/5246
Use of the WiX installation tool
http://edu.csdn.net/course/detail/5207
Tetris Game development
Http://edu.csdn.www.wanhengyl157.com net/course/detail/5110
The basics of Boost library entry
http://edu.csdn.net/course/detail/5029
Introduction to Arduino Basics
http://edu.csdn.net/course/detail/4931
Introduction to unity5.x Game Basics
http://edu.csdn.net/course/detail/4810
TensorFlow API Tips
http://edu.csdn.net/course/detail/4495
TensorFlow Introductory Basic Tutorial
http://edu.csdn.net/course/detail/4369
C + + Standard Template Library from getting started to mastering
http://edu.csdn.net/course/detail/3324
Learn C + + with old rookie
Http://edu.www.jpg157.com csdn.net/course/detail/2901
Learn Python with the old rookie
http://edu.csdn.net/course/detail/2592
Learn to use the TinyXML library in VC2015
http://edu.csdn.net/course/detail/2590
Version management and combat in SVN under Windows
http://edu.csdn.net/course/detail/2579
Basic use of Visual Studio 2015 for developing C + + programs
http://edu.csdn.net/course/detail/2570
Using the PROTOBUF protocol in VC2015
http://edu.www.qinlinyu.cn csdn.net/course/detail/2582
Learn to use MySQL database in VC2015
Http://edu.www.yibaoyule1.com csdn.net/course/detail/2672
A forward-search positive pattern using regular expressions in Python