<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 17 Jun 2019, 22:57 Daniele Zambelli, <<a href="mailto:daniele.zambelli@gmail.com">daniele.zambelli@gmail.com</a>> wrote:</div><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Mi resta ancora un problema:</div><div><br></div><div>Nella situazione (poco probabile) che nel sorgente LaTeX ci sia la sequenza "\$" in questo caso il dollaro non va considerato come un delimitatore di formule. Come posso fare a convincere re a saltare i dollari preceduti da "\"?</div><div><br></div><div>È possibile?</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><h2 style="font-family:arial,helvetica,sans-serif;font-size:24px;font-variant-numeric:normal;font-variant-east-asian:normal;color:rgb(192,76,0);border-bottom:3px solid rgb(192,76,0);padding-bottom:3px">Positive and Negative Lookbehind</h2><p style="font-family:arial,helvetica,sans-serif;text-align:justify;font-size:medium">Lookbehind has the same effect, but works backwards. It tells the regex engine to temporarily step backwards in the string, to check if the text inside the lookbehind can be matched there. <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap"><span style="background-color:rgb(96,240,64);padding-top:1px">(?<!</span><span style="background-color:rgb(255,224,192);padding-top:1px">a</span><span style="background-color:rgb(96,240,64);padding-top:1px">)</span><span style="background-color:rgb(255,224,192);padding-top:1px">b</span></span> matches a "b" that is not preceded by an "a", using negative lookbehind. It doesn't match <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,255,192)">cab</span>, but matches the <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,224,255)">b</span> (and only the <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,224,255)">b</span>) in <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,255,192)">bed</span> or <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,255,192)">debt</span>. <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap"><span style="background-color:rgb(96,240,64);padding-top:1px">(?<=</span><span style="background-color:rgb(255,224,192);padding-top:1px">a</span><span style="background-color:rgb(96,240,64);padding-top:1px">)</span><span style="background-color:rgb(255,224,192);padding-top:1px">b</span></span>(positive lookbehind) matches the <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,224,255)">b</span> (and only the <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,224,255)">b</span>) in <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,224,255)">cab</span>, but does not match <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,255,192)">bed</span> or <span style="font-family:'andale mono','lucida console',monospace;white-space:nowrap;padding-top:1px;background-color:rgb(192,255,192)">debt</span>.</p><p style="font-family:arial,helvetica,sans-serif;text-align:justify;font-size:medium"><br></p><p style="font-family:arial,helvetica,sans-serif;text-align:justify;font-size:medium"><br></p><p style="font-family:arial,helvetica,sans-serif;text-align:justify;font-size:medium">Ciao. </p><p style="font-family:arial,helvetica,sans-serif;text-align:justify;font-size:medium">Marco.</p></div></div>