I have the following use case. I need a Regex pattern to only match a line, if part of the string does not contain a different string. Here is an example:
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"/>
So here I want to match android:layout_marginStart="12dp"
so that I can replace with:
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
I have worked this one out and I can use the following regex to do it:
Find: (.*)android:layout_marginStart="(.*)"
Replace: $1android:layout_marginStart="$2"\n$1android:layout_marginLeft="$2"
What I can't do is conditionally match. I do not want to match if this xml object already contains the android:layout_marginLeft
attribute.