简体   繁体   中英

How to match everything within a word

Sorry if the title is not clear.

More specifically, using python, I want to match I am (INSERT ANYTHING)ing like I am dancing and I am walking but not I am a student and I like dancing

If I use (?<=I am)(.*)(?=ing) this would match I am a student and I like dancing

So namely (INSERT ANYTHING)ing should be one word. Is there anyway to do this?

对于您要描述的内容,您不需要后面的查找,只需在“ ing”之前加一个没有空格的模式:

r"I am ([a-zA-Z]+)ing"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM