我正在尝试找到一个Regex表达式来为我正在加载的XML(kindof)文档添加空格。问题是他们从属性中删除了空格。 (不要问我为什么,除了大小或愚蠢)C#中的标准XmlReader不会读取它们,所以我需要为属性插入空格。有任何想法吗?这是其中一个标签。
<LabelLine id="3" Direction="0"X="0.080000"Y="10.140000"Width="12.500000"Height="4.000000"Image=""Content="[1]"FontName="Arial"FontSize="8"FontWeight="400"FontStrikeOut="False"FontItalic="False"FontUnderline="False"Justify="1"BorderLeft="False"BorderTop="False"BorderRight="False"BorderBottom="False"RoundedCorners="False"BorderWidth="1"ProportionalBorder="False"/>
<LabelLine id="4" Direction="0"X="0.690000"Y="15.340000"Width="12.500000"Height="4.000000"Image=""Content="[1]"FontName="Arial"FontSize="8"FontWeight="400"FontStrikeOut="False"FontItalic="False"FontUnderline="False"Justify="1"BorderLeft="False"BorderTop="False"BorderRight="False"BorderBottom="False"RoundedCorners="False"BorderWidth="1"ProportionalBorder="False"/>
答案 0 :(得分:1)
您可以搜索("[^"]*")\s*
并将其替换为$1
和空格。