2
I have the following strings that I want to keep and delete the rests:
uicomp-type="example-string"
uicomp-type='string-example'
I use the following regex to find those strings:
uicomp-type="(.*?)"|uicomp-type='(.*?)'
How to select the strings other than those I want to keep or what's the opposite of the regex above?
I mean like NOT uicomp-type="(.*?)"|uicomp-type='(.*?)'
EDIT:
Example data set:
"Div box" => '<div uicomp-type='div-stndalone' class="ddasset-div-box"></div>',
"HTML Code" => '<div uicomp-type='div-code' class="ddasset-html-box"></div>',
"Shortcode" => '<div uicomp-type="shortcode" class="ddasset-shortcode-box"><input uicomp-type="input-shortcode" type="text" name="" value="" class="shortcodepreviewer" placeholder="Insert your shortcode here!"/></div>',
"Features list" => '<ul uicomp-type="ul" class="adtdd_ul">
<li uicomp-type="li"><i uicomp-type="icon" class="mif-checkmark"></i> <dx uicomp-type="text" class="dxeditable"> Features item 1</dx></li>
<li uicomp-type="li"><i uicomp-type="icon" class="mif-checkmark"></i> <dx uicomp-type="text" class="dxeditable"> Features item 2</dx></li>
<li uicomp-type="li"><i uicomp-type="icon" class="mif-checkmark"></i> <dx uicomp-type="text" class="dxeditable"> Features item 3</dx></li>
<li uicomp-type="li"><i uicomp-type="icon" class="mif-checkmark"></i> <dx uicomp-type="text" class="dxeditable"> Features item 4</dx></li>
<li uicomp-type="li"><i uicomp-type="icon" class="mif-checkmark"></i> <dx uicomp-type="text" class="dxeditable"> Features item 5</dx></li>
<div class="clear"></div>
</ul>',
"Separator" => '<div uicomp-type="div" class="adt-dd-separator adt-dd-separator-k"><hr uicomp-type="hr-separator"></div>',
"Badges/ ribbon" => '<div uicomp-type="null" class="dd-ribbon">
<div uicomp-type="div-ribbon" class="dd-ribbon-inner"><span uicomp-type="text" class="dxeditable">POPULAR</span></div>
</div>',
1Should be possible with a negative lookaround
(?!)
, but can't get it to click. The pattern could be shortened touicomp-type=["'](.*?)["']
btw. – bertieb – 2015-07-08T20:46:59.827I had tried to use
(?!)
and there is no luck! – Ari – 2015-07-08T20:52:33.400I think it can be done, but my regex-fu is weak.
(?!.*uicomp-type=["'].*?["'])
is the closest I've got; but it returns a whole bunch of useless zero-length matches too. Feel like I'm missing something obvious! – bertieb – 2015-07-08T20:58:23.653Haven't given up on this- do you have a small set of example data to test on? Might be able to narrow it down. – bertieb – 2015-07-10T09:25:06.050
adding the example as you requested! – Ari – 2015-07-10T17:27:02.087