我想从我的字符串中找到以下子字符串。我想找的字符串如下
<Canvas Canvas.Left="450" Canvas.Top="343.54" Width="202.5" Height="75" Background="#00FFFFFF">
<:RubberBand x:Name="RubberBand1" Canvas.ZIndex="-1" LineStroke="{Binding Path=LineColor, Mode=TwoWay, ElementName=AdvancedValueBox1}" StrokeThickness="{Binding Path=LineThickness, Mode=TwoWay, ElementName=AdvancedValueBox1}" ShowLine="{Binding Path=ShowLine, Mode=TwoWay, ElementName=AdvancedValueBox1}" TargetAnchorPosition="Center" ValueAnchorPosition="LeftCenter" X1="52.5" X2="72.5" Y1="32.5" Y2="32.5" TargetId="07d572f9-2e94-4f26-bdb7-489897c92f7d" ValueId="0d4ef226-f6c5-43f0-b4fc-c3bc6a04d16d">
<:RubberBand.TargetPropertyMappings>
<s:String>PrimaryValueBindingProperty</s:String>
<s:String>LabelBindingProperty</s:String>
<s:String>AlarmBindingProperty</s:String>
<s:String>SecondaryValueBindingProperty</s:String>
</jcge:RubberBand.TargetPropertyMappings>
<jcge:RubberBand.ValuePropertyMappings>
<s:String>PrimaryValueBindingProperty</s:String>
<s:String>LabelBindingProperty</s:String>
<s:String>AlarmBindingProperty</s:String>
<s:String>SecondaryValueBindingProperty</s:String>
</:RubberBand.ValuePropertyMappings>
</:RubberBand>
<:TemperatureMap x:Name="Room_Status1" Canvas.Left="0" Canvas.Top="0" PrimaryValueBinding="metasys-value:Object Reference 1,813" Label="adPatch" AlarmBinding="metasys-item:Alarm extension 1" NavigateTo="metasys-item:Navigation Path 1?aliasString=Aliasing String 1"
>
<:TemperatureMap.Data>
<RectangleGeometry Rect="0,0,75,75" />
</:TemperatureMap.Data>
</:TemperatureMap>
<:AdvancedValueBoxAnchor x:Name="Advanced_Value_Box1" Canvas.Left="42.5" Canvas.Top="22.5" jcge:RubberBand.ID="07d572f9-2e94-4f26-bdb7-489897c92f7d" AlarmBinding="metasys-item:Alarm%20-%20Present%20Value" PrimaryValueBinding="metasys-value:" />
<:AdvancedValueBox x:Name="AdvancedValueBox1" Canvas.Left="72.5" Canvas.Top="20" FontFamily="Arial" FontSize="11" PrimaryValueBinding="{Binding Path=PrimaryValueBinding, Mode=TwoWay, ElementName=Advanced_Value_Box1}" SecondaryValueBinding="{Binding Path=SecondaryValueBinding, Mode=TwoWay, ElementName=Advanced_Value_Box1}" AlarmBinding="{Binding Path=AlarmBinding, Mode=TwoWay, ElementName=Advanced_Value_Box1}" LabelBinding="{Binding Path=LabelBinding, Mode=TwoWay, ElementName=Advanced_Value_Box1}" jcge:RubberBand.ID="0d4ef226-f6c5-43f0-b4fc-c3bc6a04d16d" />
</Canvas>
使用Regex我该怎么做我想在我的模式中使用以下字符串。它必须包含以下字符串<Canvas
,<jcge:TemperatureMap
,<jcge:AdvancedValueBoxAnchor
和结束标记</Canvas>
答案 0 :(得分:0)
能够保证您的输入(xml)以相同的方式格式化。
修改强> 如果你给出一个你希望得到什么XML的例子,我很乐意将一段快速的代码放在一起。