简体   繁体   中英

regular expression : the dollar sign ($) work with re.match() or re.search() ?

我只知道美元符号$将匹配字符串末尾的模式,但是re.match()re.search()可以使用哪种方法?

It works with both the .search() and .match() methods.

.match() is anchored to the start of the string, but you can still require that the whole string matches by including a $ anchor.

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