<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">mais</journal-id><journal-title-group><journal-title xml:lang="ru">Моделирование и анализ информационных систем</journal-title><trans-title-group xml:lang="en"><trans-title>Modeling and Analysis of Information Systems</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">1818-1015</issn><issn pub-type="epub">2313-5417</issn><publisher><publisher-name>Yaroslavl State University</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.18255/1818-1015-2024-4-426-445</article-id><article-id custom-type="elpub" pub-id-type="custom">mais-1897</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>Theory of Computing</subject></subj-group></article-categories><title-group><article-title>Устранение неоднозначностей в расширенных регулярных выражениях с обратными ссылками посредством применения правил переписывания</article-title><trans-title-group xml:lang="en"><trans-title>Disambiguation of Regular Expressions with Backreferences via Term Rewriting</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0009-0000-9915-3039</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Исмагилова</surname><given-names>Дарья Наильевна</given-names></name><name name-style="western" xml:lang="en"><surname>Ismagilova</surname><given-names>Daria N.</given-names></name></name-alternatives><email xlink:type="simple">armi.din1902@gmail.com</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0003-3949-2164</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Непейвода</surname><given-names>Антонина Николаевна</given-names></name><name name-style="western" xml:lang="en"><surname>Nepeivoda</surname><given-names>Antonina N.</given-names></name></name-alternatives><email xlink:type="simple">a_nevod@mail.ru</email><xref ref-type="aff" rid="aff-2"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Московский государственный технический университет им. Н. Э. Баумана</institution><country>Россия</country></aff><aff xml:lang="en"><institution>Bauman Moscow State Technical University</institution><country>Russian Federation</country></aff></aff-alternatives><aff-alternatives id="aff-2"><aff xml:lang="ru"><institution>Институт Программных Систем им. А.К. Айламазяна РАН</institution><country>Россия</country></aff><aff xml:lang="en"><institution>Program Systems Institute of RAS</institution><country>Russian Federation</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2024</year></pub-date><pub-date pub-type="epub"><day>13</day><month>12</month><year>2024</year></pub-date><volume>31</volume><issue>4</issue><fpage>426</fpage><lpage>445</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Исмагилова Д.Н., Непейвода А.Н., 2024</copyright-statement><copyright-year>2024</copyright-year><copyright-holder xml:lang="ru">Исмагилова Д.Н., Непейвода А.Н.</copyright-holder><copyright-holder xml:lang="en">Ismagilova D.N., Nepeivoda A.N.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://www.mais-journal.ru/jour/article/view/1897">https://www.mais-journal.ru/jour/article/view/1897</self-uri><abstract><p>В работе рассматривается класс расширенных регулярных выражений с обратными ссылками, которые представляются как элементы полукольца, частично удовлетворяющего теоремам алгебры Клини. Используя эти теоремы в качестве правил переписывания, возможно построить алгоритм устранения неоднозначности в ячейках памяти выражений. В дальнейшем этот алгоритм может быть применён для построения обращений расширенных регулярных выражений в заданных ограничениях. Предложенные алгоритмы были апробированы на тестовой выборке регулярных выражений, построенных на базе выражений из RegexLib и StackOverflow. Результаты экспериментов показали, что в ряде случае время сопоставления с преобразованным регулярным выражением было значительно меньше, чем с исходным.</p></abstract><trans-abstract xml:lang="en"><p>In this paper we focus on regular expressions with acyclic backreferences and treat them as a semiring satisfying certain theorems of Kleene algebra. Using these theorems as term rewriting rules, we introduce an algorithm for memory disambiguation of regular expressions. Furthermore, we demonstrate that the class of regexes with acyclic backreferences is closed under language reversal, in contrast to the generic backref-regexes, and provide the reversal algorithm, based on the disambiguation procedure. The results of our experiments revealed that, in certain cases, the matching time was significantly reduced when using the reversed expressions compared to the initial ones.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>расширенные регулярные выражения</kwd><kwd>обратные ссылки</kwd><kwd>группы захвата</kwd><kwd>реверсирование</kwd><kwd>неоднозначность</kwd><kwd>алгебра Клини</kwd></kwd-group><kwd-group xml:lang="en"><kwd>extended regular expression</kwd><kwd>backreferences</kwd><kwd>Kleene algebra</kwd><kwd>capture group</kwd><kwd>reversal</kwd><kwd>disambiguation</kwd></kwd-group><funding-group><funding-statement xml:lang="ru">Российская академия наук (НИР 122012700089-0).</funding-statement><funding-statement xml:lang="en">Russian Academy of Sciences (Project no. 122012700089-0).</funding-statement></funding-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">K. R. Beesley, “Kleene, a Free and Open-Source Language for Finite-State Programming,” in Finite-State Methods and Natural Language Processing, 2012, pp. 50–54.</mixed-citation><mixed-citation xml:lang="en">K. R. Beesley, “Kleene, a Free and Open-Source Language for Finite-State Programming,” in Finite-State Methods and Natural Language Processing, 2012, pp. 50–54.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">W. Gelade and F. Neven, “Succinctness of the Complement and Intersection of Regular Expressions,” ACM Transactions on Computational Logic, vol. 13, no. 1, 2012, doi: 10.1145/2071368.2071372.</mixed-citation><mixed-citation xml:lang="en">W. Gelade and F. Neven, “Succinctness of the Complement and Intersection of Regular Expressions,” ACM Transactions on Computational Logic, vol. 13, no. 1, 2012, doi: 10.1145/2071368.2071372.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">V. M. Glushkov, “The abstract theory of automata,” Russian Mathematical Surveys, vol. 16, no. 5, pp. 3–62, 1961.</mixed-citation><mixed-citation xml:lang="en">V. M. Glushkov, “The abstract theory of automata,” Russian Mathematical Surveys, vol. 16, no. 5, pp. 3–62, 1961.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">D. Angluin, “Finding patterns common to a set of strings,” Journal of Computer and System Sciences, vol. 21, no. 1, pp. 46–62, 1980, doi: 10.1016/0022-0000(80)90041-0.</mixed-citation><mixed-citation xml:lang="en">D. Angluin, “Finding patterns common to a set of strings,” Journal of Computer and System Sciences, vol. 21, no. 1, pp. 46–62, 1980, doi: 10.1016/0022-0000(80)90041-0.</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">M. L. Schmid, “Characterising REGEX languages by regular languages equipped with factor-referencing,” Information and Computation, vol. 249, pp. 1–17, 2016, doi: 10.1016/j.ic.2016.02.003.</mixed-citation><mixed-citation xml:lang="en">M. L. Schmid, “Characterising REGEX languages by regular languages equipped with factor-referencing,” Information and Computation, vol. 249, pp. 1–17, 2016, doi: 10.1016/j.ic.2016.02.003.</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">J. Goodman, “Semiring Parsing,” Computational Linguistics, vol. 25, pp. 573–605, 1999.</mixed-citation><mixed-citation xml:lang="en">J. Goodman, “Semiring Parsing,” Computational Linguistics, vol. 25, pp. 573–605, 1999.</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">D. Kozen, “A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events,” Information and Computation, vol. 110, no. 2, pp. 366–390, 1994, doi: 10.1006/inco.1994.1037.</mixed-citation><mixed-citation xml:lang="en">D. Kozen, “A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events,” Information and Computation, vol. 110, no. 2, pp. 366–390, 1994, doi: 10.1006/inco.1994.1037.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">A. Bruggemann-Klein and D. Wood, “One-Unambiguous Regular Languages,” Information and Computation, vol. 140, no. 2, pp. 229–253, 1998, doi: 10.1006/inco.1997.2688.</mixed-citation><mixed-citation xml:lang="en">A. Bruggemann-Klein and D. Wood, “One-Unambiguous Regular Languages,” Information and Computation, vol. 140, no. 2, pp. 229–253, 1998, doi: 10.1006/inco.1997.2688.</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">M. Berglund and B. van der Merwe, “Re-examining regular expressions with backreferences,” Theoretical Computer Science, vol. 940, pp. 66–80, 2023, doi: 10.1016/j.tcs.2022.10.041.</mixed-citation><mixed-citation xml:lang="en">M. Berglund and B. van der Merwe, “Re-examining regular expressions with backreferences,” Theoretical Computer Science, vol. 940, pp. 66–80, 2023, doi: 10.1016/j.tcs.2022.10.041.</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">D. D. Freydenberger and M. L. Schmid, “Deterministic regular expressions with back-references,” Journal of Computer and System Sciences, vol. 105, pp. 1–39, 2019, doi: 10.1016/j.jcss.2019.04.001.</mixed-citation><mixed-citation xml:lang="en">D. D. Freydenberger and M. L. Schmid, “Deterministic regular expressions with back-references,” Journal of Computer and System Sciences, vol. 105, pp. 1–39, 2019, doi: 10.1016/j.jcss.2019.04.001.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Li et al., “ReDoSHunter: A Combined Static and Dynamic Approach for Regular Expression DoS Detection,” in 30th USENIX Security Symposium, 2021, pp. 3847–3864.</mixed-citation><mixed-citation xml:lang="en">Y. Li et al., “ReDoSHunter: A Combined Static and Dynamic Approach for Regular Expression DoS Detection,” in 30th USENIX Security Symposium, 2021, pp. 3847–3864.</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">C. Campeanu, K. Salomaa, and S. Yu, “A Formal Study Of Practical Regular Expressions,” International Journal of Foundations of Computer Science, vol. 14, pp. 1007–1018, 2003, doi: 10.1142/S012905410300214X.</mixed-citation><mixed-citation xml:lang="en">C. Campeanu, K. Salomaa, and S. Yu, “A Formal Study Of Practical Regular Expressions,” International Journal of Foundations of Computer Science, vol. 14, pp. 1007–1018, 2003, doi: 10.1142/S012905410300214X.</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">N. Chida and T. Terauchi, “On Lookaheads in Regular Expressions with Backreferences,” IEICE Transactions on Information and Systems, vol. E106--D, no. 5, pp. 959–975, 2023, doi: 10.1587/transinf.2022EDP7098.</mixed-citation><mixed-citation xml:lang="en">N. Chida and T. Terauchi, “On Lookaheads in Regular Expressions with Backreferences,” IEICE Transactions on Information and Systems, vol. E106--D, no. 5, pp. 959–975, 2023, doi: 10.1587/transinf.2022EDP7098.</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">D. Reidenbach and M. L. Schmid, “Patterns with bounded treewidth,” Information and Computation, vol. 239, pp. 87–99, 2014, doi: 10.1016/j.ic.2014.08.010.</mixed-citation><mixed-citation xml:lang="en">D. Reidenbach and M. L. Schmid, “Patterns with bounded treewidth,” Information and Computation, vol. 239, pp. 87–99, 2014, doi: 10.1016/j.ic.2014.08.010.</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">M. L. Schmid, “Inside the Class of REGEX Languages,” in Proceedings of the 16th International Conference on Developments in Language Theory, 2012, pp. 73–84, doi: 10.1007/978-3-642-31653-1_8.</mixed-citation><mixed-citation xml:lang="en">M. L. Schmid, “Inside the Class of REGEX Languages,” in Proceedings of the 16th International Conference on Developments in Language Theory, 2012, pp. 73–84, doi: 10.1007/978-3-642-31653-1_8.</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">A. Br"uggemann-Klein, “Regular Expressions into Finite Automata,” Theoretical Computer Science, vol. 120, no. 2, pp. 197–213, 1993, doi: 10.1016/0304-3975(93)90287-4.</mixed-citation><mixed-citation xml:lang="en">A. Br"uggemann-Klein, “Regular Expressions into Finite Automata,” Theoretical Computer Science, vol. 120, no. 2, pp. 197–213, 1993, doi: 10.1016/0304-3975(93)90287-4.</mixed-citation></citation-alternatives></ref><ref id="cit17"><label>17</label><citation-alternatives><mixed-citation xml:lang="ru">S. Kahrs and C. Runciman, “Simplifying regular expressions further,” Journal of Symbolic Computation, vol. 109, pp. 124–143, 2022, doi: 10.1016/j.jsc.2021.08.003.</mixed-citation><mixed-citation xml:lang="en">S. Kahrs and C. Runciman, “Simplifying regular expressions further,” Journal of Symbolic Computation, vol. 109, pp. 124–143, 2022, doi: 10.1016/j.jsc.2021.08.003.</mixed-citation></citation-alternatives></ref><ref id="cit18"><label>18</label><citation-alternatives><mixed-citation xml:lang="ru">J. McClurg, M. Claver, J. Garner, J. Vossen, J. Schmerge, and M. E. Belviranli, “Optimizing Regular Expressions via Rewrite-Guided Synthesis,” in Proceedings of the International Conference on Parallel Architectures and Compilation Techniques, 2023, pp. 426–438, doi: 10.1145/3559009.3569664.</mixed-citation><mixed-citation xml:lang="en">J. McClurg, M. Claver, J. Garner, J. Vossen, J. Schmerge, and M. E. Belviranli, “Optimizing Regular Expressions via Rewrite-Guided Synthesis,” in Proceedings of the International Conference on Parallel Architectures and Compilation Techniques, 2023, pp. 426–438, doi: 10.1145/3559009.3569664.</mixed-citation></citation-alternatives></ref><ref id="cit19"><label>19</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Li et al., “RegexScalpel: Regular Expression Denial of Service (ReDoS) Defense by Localize-and-Fix,” in 31st USENIX Security Symposium (USENIX Security 22), 2022, pp. 4183–4200.</mixed-citation><mixed-citation xml:lang="en">Y. Li et al., “RegexScalpel: Regular Expression Denial of Service (ReDoS) Defense by Localize-and-Fix,” in 31st USENIX Security Symposium (USENIX Security 22), 2022, pp. 4183–4200.</mixed-citation></citation-alternatives></ref><ref id="cit20"><label>20</label><citation-alternatives><mixed-citation xml:lang="ru">N. Chida and T. Terauchi, “Repairing DoS Vulnerability of Real-World Regexes,” in Proceedings of the IEEE Symposium on Security and Privacy (SP), 2022, pp. 2060–2077, doi: 10.1109/SP46214.2022.9833597.</mixed-citation><mixed-citation xml:lang="en">N. Chida and T. Terauchi, “Repairing DoS Vulnerability of Real-World Regexes,” in Proceedings of the IEEE Symposium on Security and Privacy (SP), 2022, pp. 2060–2077, doi: 10.1109/SP46214.2022.9833597.</mixed-citation></citation-alternatives></ref><ref id="cit21"><label>21</label><citation-alternatives><mixed-citation xml:lang="ru">Y. Uezato, “Regular Expressions with Backreferences and Lookaheads Capture NLOG,” in 51st International Colloquium on Automata, Languages, and Programming (ICALP 2024), 2024, pp. 155:1–155:20, doi: 10.4230/LIPIcs.ICALP.2024.155.</mixed-citation><mixed-citation xml:lang="en">Y. Uezato, “Regular Expressions with Backreferences and Lookaheads Capture NLOG,” in 51st International Colloquium on Automata, Languages, and Programming (ICALP 2024), 2024, pp. 155:1–155:20, doi: 10.4230/LIPIcs.ICALP.2024.155.</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
