Regular expression - Combine positive & negative lookaheadNotepad++ regular expression helpNon-greedy...

How do I reattach a shelf to the wall when it ripped out of the wall?

Do I have to worry about players making “bad” choices on level up?

How did Captain America manage to do this?

Apply MapThread to all but one variable

How to reduce LED flash rate (frequency)

Does a semiconductor follow Ohm's law?

Will tsunami waves travel forever if there was no land?

Can someone publish a story that happened to you?

How exactly does Hawking radiation decrease the mass of black holes?

French for 'It must be my imagination'?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

Why does nature favour the Laplacian?

How can I practically buy stocks?

a sore throat vs a strep throat vs strep throat

Don’t seats that recline flat defeat the purpose of having seatbelts?

Meaning of Bloch representation

Does the sign matter for proportionality?

Reducing vertical space in stackrel

What are the potential pitfalls when using metals as a currency?

What do the phrase "Reeyan's seacrest" and the word "fraggle" mean in a sketch?

Combinable filters

Unexpected email from Yorkshire Bank

Pulling the rope with one hand is as heavy as with two hands?

Critique of timeline aesthetic



Regular expression - Combine positive & negative lookahead


Notepad++ regular expression helpNon-greedy regular expression in edNotepad++ Regular Expression AssistanceRegex positive lookahead when lookahead data doesn't exist (PCRE)Regular Expression - rename picturesRegular expression for deleting duplicated filesregular expression not matching partially a stringRegular expressioncombine several regexes with negative and positive lookaheadregular expression MS Word






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have basic knowledge in regex but not when it comes to lookaheads :-)

I have the following example:



<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>


I only want the text within div id s32 to match. I'm experimenting with a positive lookahead first to se if I can get at least that part right but while



(?<="s32".+)Some text


does work, this one



(?<="s32".+¤¤)Some text


doesn't...



I'm trying to understand why I don't get any match on this? With the above example I expected to get 3 matches. Once I understand this I could experiment with a negative lookahead that would then hopefully only give 2 matches (within the s32 DIVs).



Any advice and explanation is welcome as I'm currently a little bit lost :-)










share|improve this question









New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • What language/tool are you using? Variable length look behind is not handle by many regex flavour.

    – Toto
    yesterday











  • Hi Toto. I'm using a tool called RegEx Tester V3.2.0.0 and only use this tool to perform search and replace actions on source code which I then export. If there is a better tool that you would recommend me to look at then I'm more than happy to do so.

    – user3624244
    yesterday


















1















I have basic knowledge in regex but not when it comes to lookaheads :-)

I have the following example:



<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>


I only want the text within div id s32 to match. I'm experimenting with a positive lookahead first to se if I can get at least that part right but while



(?<="s32".+)Some text


does work, this one



(?<="s32".+¤¤)Some text


doesn't...



I'm trying to understand why I don't get any match on this? With the above example I expected to get 3 matches. Once I understand this I could experiment with a negative lookahead that would then hopefully only give 2 matches (within the s32 DIVs).



Any advice and explanation is welcome as I'm currently a little bit lost :-)










share|improve this question









New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • What language/tool are you using? Variable length look behind is not handle by many regex flavour.

    – Toto
    yesterday











  • Hi Toto. I'm using a tool called RegEx Tester V3.2.0.0 and only use this tool to perform search and replace actions on source code which I then export. If there is a better tool that you would recommend me to look at then I'm more than happy to do so.

    – user3624244
    yesterday














1












1








1








I have basic knowledge in regex but not when it comes to lookaheads :-)

I have the following example:



<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>


I only want the text within div id s32 to match. I'm experimenting with a positive lookahead first to se if I can get at least that part right but while



(?<="s32".+)Some text


does work, this one



(?<="s32".+¤¤)Some text


doesn't...



I'm trying to understand why I don't get any match on this? With the above example I expected to get 3 matches. Once I understand this I could experiment with a negative lookahead that would then hopefully only give 2 matches (within the s32 DIVs).



Any advice and explanation is welcome as I'm currently a little bit lost :-)










share|improve this question









New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have basic knowledge in regex but not when it comes to lookaheads :-)

I have the following example:



<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s32" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
¤&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br>¤¤</DIV></DIV>

<DIV style="overflow: hidden; border-bottom: 1px Solid rgb(192,192,192); position: absolute; left: 5821px; top: 22px; width: 1200px; height: 166px; "><DIV ID="s33" style="position: absolute; left: 8px; top: 2px; width: 1185px; height: 162px; " >
&lt;h1&gt;Some text within h1 tags.&lt;/h1&gt;&lt;<br></DIV></DIV>


I only want the text within div id s32 to match. I'm experimenting with a positive lookahead first to se if I can get at least that part right but while



(?<="s32".+)Some text


does work, this one



(?<="s32".+¤¤)Some text


doesn't...



I'm trying to understand why I don't get any match on this? With the above example I expected to get 3 matches. Once I understand this I could experiment with a negative lookahead that would then hopefully only give 2 matches (within the s32 DIVs).



Any advice and explanation is welcome as I'm currently a little bit lost :-)







regex






share|improve this question









New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 6 hours ago









zx485

1,4732914




1,4732914






New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









user3624244user3624244

61




61




New contributor




user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user3624244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • What language/tool are you using? Variable length look behind is not handle by many regex flavour.

    – Toto
    yesterday











  • Hi Toto. I'm using a tool called RegEx Tester V3.2.0.0 and only use this tool to perform search and replace actions on source code which I then export. If there is a better tool that you would recommend me to look at then I'm more than happy to do so.

    – user3624244
    yesterday



















  • What language/tool are you using? Variable length look behind is not handle by many regex flavour.

    – Toto
    yesterday











  • Hi Toto. I'm using a tool called RegEx Tester V3.2.0.0 and only use this tool to perform search and replace actions on source code which I then export. If there is a better tool that you would recommend me to look at then I'm more than happy to do so.

    – user3624244
    yesterday

















What language/tool are you using? Variable length look behind is not handle by many regex flavour.

– Toto
yesterday





What language/tool are you using? Variable length look behind is not handle by many regex flavour.

– Toto
yesterday













Hi Toto. I'm using a tool called RegEx Tester V3.2.0.0 and only use this tool to perform search and replace actions on source code which I then export. If there is a better tool that you would recommend me to look at then I'm more than happy to do so.

– user3624244
yesterday





Hi Toto. I'm using a tool called RegEx Tester V3.2.0.0 and only use this tool to perform search and replace actions on source code which I then export. If there is a better tool that you would recommend me to look at then I'm more than happy to do so.

– user3624244
yesterday










0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






user3624244 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1429940%2fregular-expression-combine-positive-negative-lookahead%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








user3624244 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















user3624244 is a new contributor. Be nice, and check out our Code of Conduct.













user3624244 is a new contributor. Be nice, and check out our Code of Conduct.












user3624244 is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1429940%2fregular-expression-combine-positive-negative-lookahead%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...