{"id":342,"date":"2007-10-01T12:18:52","date_gmt":"2007-10-01T11:18:52","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2007\/10\/01\/regex-legbelso-parok-keresesere\/"},"modified":"2007-10-01T12:18:52","modified_gmt":"2007-10-01T11:18:52","slug":"regex-legbelso-parok-keresesere","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2007\/10\/01\/regex-legbelso-parok-keresesere\/","title":{"rendered":"Regex legbels\u0151 p\u00e1rok keres\u00e9s\u00e9re"},"content":{"rendered":"<p>\u00c9rdekes <a href=\"http:\/\/devportal.hu\/portal\/Posts.aspx?TopicID=de39629e-d522-4ea3-83bd-a63cd8af0ecf&#038;Page=0#218714e8-b797-4ce7-9153-9515fc48fecf\">k\u00e9rd\u00e9s<\/a> j\u00f6tt fel a devport\u00e1lon.<br \/>\nP\u00e1rokat kell keresni egy sz\u00f6vegben, de \u00fagy, hogy a legbels\u0151 p\u00e1rokat tal\u00e1ljuk meg.<\/p>\n<p>Pl. begin end begin end, ebben k\u00e9t begin end-et kell tal\u00e1lni, nem pedig egy nagyot, amiben benne van egy end begin.<\/p>\n<p>A p\u00e1rost k\u00f6nny\u0171 megfogni, amit nehezebb, hogy sz\u0171k\u00edts\u00fck le a legkisebb halmazra a kifejez\u00e9st.<\/p>\n<p>Eset\u00fcnkben \u00fagy gondolkodhatunk, hogy begin azt\u00e1n ak\u00e1rmib\u0151l legal\u00e1bb egy majd end, \u00e9s a kett\u0151 k\u00f6z\u00f6tt nem lehet end. Ezzel megakad\u00e1lyozhat\u00f3k az \u00e1tlapolt eredm\u00e9nyek.<\/p>\n<p>A probl\u00e9m\u00e1t a zero-width negative lookahead assertion tudja megoldani, amely &#8220;Continues match only if the subexpression does not match at this position on the right.&#8221;<\/p>\n<p>Ez egy ilyen zero-width negative lookahead assertion iz\u00e9: (?!end). Azt jelenti, hogy jobbr\u00f3l (azaz a ) ut\u00e1n) nem lehet olyan, hogy end karakterek.<\/p>\n<p>Azaz a p\u00e9ld\u00e1nkra: begin(.(?!end)).+?end <\/p>\n<p>Ahhoz, hogy ez t\u00f6bb sorra is menjen, a . \u00e9rtelmez\u00e9s\u00e9t ki kell terjeszteni a \\n-re is, .netben a Single Line m\u00f3d biztos\u00edtja ezt.<\/p>\n<p>J\u00f3 cikk a <a href=\"http:\/\/blog.stevenlevithan.com\/archives\/match-innermost-html-element\">t\u00e9m\u00e1ban<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c9rdekes k\u00e9rd\u00e9s j\u00f6tt fel a devport\u00e1lon. P\u00e1rokat kell keresni egy sz\u00f6vegben, de \u00fagy, hogy a legbels\u0151 p\u00e1rokat tal\u00e1ljuk meg. Pl. begin end&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,57],"tags":[],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-szakmai-elet","category-regex"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/342\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}