I am using many different Regex implementations as this happens on several systems (Linux, Windows, VS, notepad++, etc.); it's just where I have a customer who wants to remove auto sizing. The intent is to use regex in which ever tool to find any line that has a width but doesn't have an autowidth and then add autowidth. I am just asking about how to find it, but I intend to then use what I find here in a replacement string for my given editor. I have the replacement bit down: I just haven't figured out how to get one with out the other when the other is far away from the one.
Using https://regex101.com/ I've tried literally dozens of search strings.
This was my starting point for a search string and a couple of attempts to get the lookarounds to exclude AutoWidth anywhere on the line. String 2 and 3 are basically the same thing, but I didn't know what else to try. I assume that anything that works for the lookbehind will work for the lookahead, but as you can see, I can't even the behind working.
(?<! AutoWidth="false") width="\d*"(?! AutoWidth="false") (?<! AutoWidth="false").*? width="\d*"(?! AutoWidth="false") (?<! AutoWidth="false")[0-9a-zA-Z" =]*? width="\d*"(?! AutoWidth="false")
I'm stuck, putting distance between AutoWidth and width is eluding me.
These are my targets
1-> <column name="Selected" AutoWidth="false" IsEditable="true" datatype="bool" width="20"/> 2-> <column width="40" AutoWidth="false" name="ExternalIdOrEmpty" index="XIDname" sort="true"/> 3-> <column width="40" name="Tax Rate" index="TRname" sort="true" AutoWidth="false"/> 4-> <column width="40" name="Total Tax" index="TTname" sort="true"/> 5-> <column name="Tax Deductible" index="TDname" sort="true"/>
I want to find all lines that contain
width="\d*"
but that do not contain
AutoWidth="\d*"
anywhere on the same line.
This means that only line 4, in the samples above, would match my criteria.
UPDATE:
I am willing to use any other tool that will get the job done. So XSLT, etc. are all good. The only requirement there is that the tool is generally available on Windows, Linux, & Mac, AND is either open source or free and is also well known.
The full xml is huge. The edit function here is limited to 30,00 characters but here's a good sample.
<?xml version="1.0" encoding="utf-8" ?>
<spread>
<ViewPatientOutboundReferralFilter>
<FindColumn name="ViewUid" index="guid" visible="false" />
<FindColumn name="Selected" caption=" " visible="true" IsEditable="true" datatype="bool"/>
<FindColumn name="PatientName" caption="Patient Name" visible="true" width="150" hyperlink="true" AutoWidth="false"/>
<FindColumn name="ReferToProviderName" caption="Provider" visible="true" AutoWidth="false" width="150" hyperlink="true"/>
<FindColumn name="ReferredToMedicalServicesProviderName" caption="Medical Services Provider" visible="true" width="150" hyperlink="true"/>
<FindColumn name="ProviderRole" caption="Provider Role" visible="true" width="80" hyperlink="true"/>
<FindColumn name="StatusName" caption="Current Status" visible="true" width="100" hyperlink="true"/>
<FindColumn name="ServiceSiteName" caption="Service Site" visible="true"/>
<FindColumn name="VisitDate" caption="Visit Date" visible="true" width="90" datatype="date"/>
<FindColumn name="AppointmentDate" caption="Appointment Date" visible="true" datatype="datetime" width="90"/>
<FindColumn name="Notes" caption="Comments" visible="true" width="120"/>
<FindColumn name="AppointmentNotes" caption="Referral Notes" visible="true" width="120"/>
<FindColumn name="DisplayName" visible="false" index="name" />
<FindColumn name="ProviderUid" visible="false" storeproperty="true" />
<FindColumn name="VisitUid" visible="false" storeproperty="true" />
<FindColumn name="CreatedDate" caption="Created Date" visible="true" datatype="date" width="90"/>
<FindColumn name="RequestingName" caption="Requesting Provider" visible="true" width="150" />
</ViewPatientOutboundReferralFilter>
<FeeScheduleFeeAA rowcount="3">
<column row="0" rowspan="3" caption="Code" width="50" name="Procedure.Code" sort="true" index="name" />
<column row="0" rowspan="3" caption="Description" relwidth="100%" width="80" AutoWidth="false" name="Procedure.ShortDescription" sort="true" />
<column row="0" rowspan="3" caption="Amount Allowed" width="60" AutoWidth="false" name="Fee" IsEditable="true" datatype="currency" />
<column row="0" rowspan="3" caption="Global Period" width="40" AutoWidth="false" name="GlobalPeriodDays" IsEditable="true" datatype="number" decimalPlaces="0" minValue="0" maxValue="1000" />
<column row="0" colspan="5" caption="Coinsurance" />
<column row="1" colspan="2" caption="Insurance Percent" />
<column row="2" caption=" " width="30" AutoWidth="false" name="RadioInsurancePercent" IsEditable="true" datatype="radio" radioOrientation="vertical" radioItems=" " />
<column row="2" caption="Value" width="70" AutoWidth="false" name="InsurancePercent" IsEditable="true" datatype="number" decimalPlaces="0" minValue="0" maxValue="100" />
<column row="1" colspan="2" caption="Insurance Plan" />
<column row="2" caption="PCP/Specialist" width="95" AutoWidth="false" name="RadioInsurancePlanPhysician" IsEditable="true" datatype="radio" radioOrientation="vertical" radioItems=" " />
<column row="2" caption="Other" width="55" AutoWidth="false" name="RadioInsurancePlanOther" IsEditable="true" datatype="radio" radioOrientation="vertical" radioItems=" " />
<column row="1" rowspan="2" caption="Copay Amount" width="70" AutoWidth="false" name="FixedCopayAmount" datatype="currency" IsEditable="true" />
<column row="0" rowspan="3" caption="Contract Type" width="55" AutoWidth="false" name="ContractTypeCode.Name" sort="true"/>
<column row="0" rowspan="3" caption="Family Planning" width="55" AutoWidth="false" name="FamilyPlanning" IsEditable="true" datatype="bool" />
<column row="0" rowspan="3" caption="Alt Insurance Plan" width="55" AutoWidth="false" name="UseAlternateInsurancePlan" IsEditable="true" datatype="bool" />
<column row="0" rowspan="3" caption="Edit Billing Rule" width="70" visible="false" IsEditable="true" datatype="CustomCellType" celltype="iMedica.Prm.Client.UI.BaseControls.Spread.PrmNeoCellImageButton,iMedica.Prm.Client.UI.BaseControls" ShowSortIndicator="false" ImageResourceName="iMedica.Prm.Client.UI.BaseControls.Icons.BillingRule.png" ImageResourceAssembly="iMedica.Prm.Client.UI.BaseControls" sort="false" />
</FeeScheduleFeeAA>
</spread>