- AuthorPosts
- October 5, 2022 at 5:22 am #28574spirosParticipant
I am trying to match something like this, where instances of (.*?) is to match any text, but not if it contains < or >.
<q class=”grc”>(.*?)</q> = {itr}(.*?){/i}
And then extract some strings like this: \1\t\2So for example, it should match
<q class="grc">ἐν τῇ τήμερον ... αἰθρίᾳ</q> = {itr}en un día tan claro como hoy{/i}
But it should not match
<q class="grc">ἐξ αἰθρίης τε καὶ νηνεμίης θαλάσσης</q></span> Hdt.7.188. {br}{num}2{/num} esp. [[la noche]] o [[madrugada clara y fría]], [[el sereno]], [[el relente]] (cuando cae el rocío y la helada) <span class="cit" id="αἰθρίαcit6"><q class="grc">θερμότερον ... τὸ ὕδωρ τῆς τε αἰθρίης καὶ τῆς δρόσου</q> = {itr}el agua<i> (está) </i>más caliente que el sereno y el rocío{/i}
I tried using negative lookahead like this
<q class="grc">((?!<).*)</q> = {itr}((?!<).*?){/i}
but it did not help.Here is some sample text
<q class="grc">αἰθρίην δ' αὖτις ἔθηκεν ἰδεῖν</q></span> Sol.l.c., cf. Arist.{i}Mete{/i}.342{sup}a{/sup}12, Luc.{i}Halc{/i}.4, D.C.{i}Epit{/i}.9.6.3, <span class="cit" id="αἰθρίαcit2"><q class="grc">ἐξ αἰθρίης ἀστράψω</q></span> Cratin.58, cf. Hdt.3.86, X.{i}HG{/i} 7.1.31, D.C.37.25.2, prob. Democr.B 152, uso abs. <span class="cit" id="αἰθρίαcit3"><q class="grc">(τῆς) αἰθρίας (οὔσης)</q> = {itr}con<i>, </i>en buen tiempo{/i}</span> Hdt.7.37, Ar.{i}Nu{/i}.371, <span class="cit" id="αἰθρίαcit4"><q class="grc">ἐν τῇ τήμερον ... αἰθρίᾳ</q> = {itr}en un día tan claro como hoy{/i}</span>, {i}Com.Adesp{/i}.1001.14 {br}{num}•{/num} del mar [[bonanza]] <span class="cit" id="αἰθρίαcit5"><q class="grc">ἐξ αἰθρίης τε καὶ νηνεμίης θαλάσσης</q></span> Hdt.7.188. {br}{num}2{/num} esp. [[la noche]] o [[madrugada clara y fría]], [[el sereno]], [[el relente]] (cuando cae el rocío y la helada) <span class="cit" id="αἰθρίαcit6"><q class="grc">θερμότερον ... τὸ ὕδωρ τῆς τε αἰθρίης καὶ τῆς δρόσου</q> = {itr}el agua<i> (está) </i>más caliente que el sereno y el rocío{/i}</span> Hdt.2.68, <span class="cit" id="αἰθρίαcit7"><q class="grc">θεῖναι ἐς τὴν αἰθρίην</q> = {itr}poner al relente{/i}
October 5, 2022 at 7:43 am #28578Yutaka EmuraKeymasterPlease simplify your samples as much as possible while you can still reproduce the issue, and clarify the last part of your question (after “I tried using negative lookahead like this”). Please add explanations why you believe your regular expression should not match or does not help.
October 5, 2022 at 9:37 am #28591spirosParticipantBasically, I want to adapt (.*?) in a way that it will match anything, but it will stop matching if the character < or > appears. Does that make it simpler?
What I tried was
((?!<).*?)October 5, 2022 at 1:48 pm #28601Yutaka EmuraKeymasterI am not sure if I understand your question. Please write a simple sample with a simple regex to reproduce the issue.
- AuthorPosts
- You must be logged in to reply to this topic.