How to trim spaces in xml tags using regular expression in notepad++?

随声附和 提交于 2019-12-04 16:22:51

If the tags only have one space in them and no attributes, this will work

find: <(/?)(\w*) (\w*)>

replace: <\1\2\3>

Using a LookAhead we can repair any number of spaces in a tag:

Search for: \s+(?=[\s\w]*>)
Replace with nothing

Explained demo here: http://www.regex101.com/r/dY6zC2

Note: LookAhead is available in NotePad++ since version 6.0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!