使用带有命名参数的Python中的正则表达式替换文本

时间:2012-10-25 06:05:33

标签: python regex django

我有字符串"(r'^users/', include('users.urls')),"。我希望用户能够将其更改为"(r'^users_part_has_been_changed_by_user/', include('users.urls')),"

正则表达式为'\s*[url]?\(r?["|\'](?P<pattern>[^\'"]+)["|\'],\s*include\(["|\'](?P<include>[^\'"]+)["|\']\)\),'

enter image description here

0 个答案:

没有答案