{"id":2229,"date":"2020-08-13T02:37:25","date_gmt":"2020-08-12T17:37:25","guid":{"rendered":"http:\/\/141.164.34.82\/?p=2229"},"modified":"2020-08-13T02:39:36","modified_gmt":"2020-08-12T17:39:36","slug":"rex-look-around","status":"publish","type":"post","link":"http:\/\/ds.sumeun.org\/?p=2229","title":{"rendered":"REX: Look around"},"content":{"rendered":"<h2><code>strsplit<\/code><\/h2>\n<p><code>strsplit<\/code>\uc740 \ubb38\uc790\uc5f4\uc744 \uc8fc\uc5b4\uc9c4 \ubb38\uc790(\uc5f4)\uc744 \uae30\uc900\uc73c\ub85c \ubd84\ub9ac\ud55c\ub2e4.<\/p>\n<p>\ub2e4\uc74c\uc758 \ub367\uc148\uc744 \uad6c\uc131\ud558\ub294 \ubaa8\ub4e0 \uc22b\uc790\ub97c \ubd84\ub9ac\ud574\ub0b4\uace0\uc790 \ud55c\ub2e4\uba74,<\/p>\n<pre><code class=\"r\">txt = '32+45+33+42+ 24 + 22 + 3'\r\nstrsplit(txt, ' *[+] *')\r\n<\/code><\/pre>\n<pre>## [[1]]\r\n## [1] \"32\" \"45\" \"33\" \"42\" \"24\" \"22\" \"3\"\r\n<\/pre>\n<p>\ub2e8\uc21c\ud788 <code>+<\/code>\ub97c \uc5c6\uc560\ub294 \uac83\uc774 \uc544\ub2c8\ub77c <code>+<\/code>\uc640 \uc22b\uc790 \uc0ac\uc774\uc758 \uc2a4\ud398\uc774\uc2a4\ub3c4 \uc801\uc808\ud558\uac8c \uc5c6\uc560\uc904 \uc218 \uc788\ub2e4.<\/p>\n<h2>\uc0ac\ub77c\uc9c4 \ubb38\uc790<\/h2>\n<p>\uc0ac\ub77c\uc9c4 \uae00\uc790\uac00 \uadf8\ub9ac\uc6b8 \uc218\ub3c4 \uc788\ub2e4. \ubd84\ub9ac\ub41c \ubb38\uc790\uac00 \uc6d0\ubcf8 \uadf8\ub300\ub85c\ub97c \ubaa8\ub450 \ubcf4\uc874\ud558\uace0 \uc2f6\uc744 \uc218\ub3c4 \uc788\ub2e4.<\/p>\n<p>\ud558\uc9c0\ub9cc <code>strsplit<\/code>\uc740 \uae30\uc900 \ubb38\uc790(\uc5f4)\uc744 \uc81c\uac70\ud558\uace0 \ubb38\uc790\uc5f4\uc758 \uc55e\ub4a4\ubd80\ubd84\ub9cc\uc744 \ubcf4\uc874\ud558\ub294\ub370 \uc5b4\uca4c\ub098? \ubc29\ubc95\uc740 \uae30\uc900 \ubb38\uc790\uac00 \uae38\uc774 0\uc778 \ubb38\uc790\ub85c \ud558\ub294 \uac83\uc774\ub2e4. \uc751? PCRE\uc5d0\ub294 Look Around\uac00 \uc788\ub2e4!<\/p>\n<pre><code class=\"r\">txt = '32+45+33+42+ 24 + 22 + 3'\r\nstrsplit(txt, '(?&lt;=[+])', perl=TRUE)\r\n<\/code><\/pre>\n<pre>## [[1]]\r\n## [1] \"32+\"   \"45+\"   \"33+\"   \"42+\"   \" 24 +\" \" 22 +\" \" 3\"\r\n<\/pre>\n<p><code>(?&lt;= )<\/code>\uc744 \uc0ac\uc6a9\ud558\uba74 \uc55e\ucabd\uc5d0 \ud2b9\uc218\ud55c \ubb38\uc790\uac00 \uc624\uae38 \uae30\ub300\ud55c\ub2e4. <code>(?&lt;=a)b<\/code>\ub294 <code>ab<\/code>\uc758 <code>b<\/code>\ub97c \ub098\ud0c0\ub0b4\uc9c0\ub9cc, <code>cb<\/code>\uc758 <code>b<\/code>\ub294 \ud574\ub2f9\ud558\uc9c0 \uc54a\ub294\ub2e4. <code>(?&lt;=a)<\/code>\ub77c\uace0 \uc4f0\uba74? \uc5b4\ub5a4 \uacf3\uc774\ub358 <code>a<\/code>\uac00 \uc55e\uc5d0 \ub098\ud0c0\ub098\ub294 <strong>\uc9c0\uc810<\/strong>\uc744 \uc758\ubbf8\ud55c\ub2e4. \uc608\ub97c \ub4e4\uc5b4 <code>bacd<\/code>\uc758 <code>a<\/code>\uc640 <code>c<\/code> \uc0ac\uc774, <code>hamster<\/code>\uc758 <code>a<\/code>\uc640 <code>m<\/code> \uc0ac\uc774\ub97c \ub098\ud0c0\ub0b8\ub2e4. \ub530\ub77c\uc11c <code>strsplit<\/code>\uc5d0 \uc4f4\ub2e4\uba74, \ubd84\ub9ac\ud560 \uc9c0\uc810\uc740 \uc788\uc9c0\ub9cc, \uc81c\uac70\ub418\ub294 \ubb38\uc790\ub294 \uc5c6\ub2e4.<\/p>\n<h2>\ubd84\ub9ac\ub420 \uc9c0\uc810\uc744 \uc0c1\uc138\ud654<\/h2>\n<p><a href=\"https:\/\/www.regular-expressions.info\/lookaround.html\">Look around\ub294 Look ahead\uc640 Look behind\uac00 \uc788\ub2e4.<\/a> \uc774\ub97c \ud65c\uc6a9\ud558\uba74 \ubd84\ub9ac\ub420 <strong>\uc9c0\uc810<\/strong>\uc744 \uc880 \ub354 \uc0c1\uc138\ud654\ud560 \uc218 \uc788\ub2e4. \uc608\ub97c \ub4e4\uc5b4 \uc55e\uc5d0\ub294 \ubb38\uc790, \ub4a4\uc5d0\ub294 \uc22b\uc790\uac00 \ub098\uc624\ub294 \uc9c0\uc810\uc5d0\uc11c \ubd84\ub9ac\ub97c \ud558\uace0\uc790 \ud55c\ub2e4\uba74,<\/p>\n<pre><code class=\"r\">txt = 'there are2 people over there. I saw3children'\r\nstrsplit(txt, '(?&lt;=\\\\w)(?=\\\\d)', perl=TRUE)\r\n<\/code><\/pre>\n<pre>## [[1]]\r\n## [1] \"there are\"                  \"2 people over there. I saw\" \"3children\"\r\n<\/pre>\n<p><code>\\w<\/code>\ub294 \uc54c\ud30c\ubcb3\uacfc \uc22b\uc790, \uadf8\ub9ac\uace0 <code>_<\/code>\ub97c \ub098\ud0c0\ub0b4\uace0, <code>\\d<\/code>\ub294 \uc22b\uc790\ub97c \uc758\ubbf8\ud55c\ub2e4.<\/p>\n<pre><code class=\"r\">txt = '\uac70\uae302 \uba85\uc774 \uc788\uc5c8\uc5b4. \uc544 \uc624\ub2983\uc2dc\uc5d0 \ubcfc\uaebc\uc9c0? \uc544 \ub9de\ub2e4 4\uc2dc\uc600\uc9c0?'\r\nstrsplit(txt, '(?&lt;=\\\\w)(?=\\\\d)', perl=TRUE)\r\n<\/code><\/pre>\n<pre>## [[1]]\r\n## [1] \"\uac70\uae302 \uba85\uc774 \uc788\uc5c8\uc5b4. \uc544 \uc624\ub2983\uc2dc\uc5d0 \ubcfc\uaebc\uc9c0? \uc544 \ub9de\ub2e4 4\uc2dc\uc600\uc9c0?\"\r\n<\/pre>\n<p>UNICODE \uc815\uaddc\ud45c\ud604\uc2dd\uc73c\ub85c <code>\\p{L}<\/code>\uc740 \ubb38\uc790\ub97c \ub098\ud0c0\ub0b8\ub2e4.<\/p>\n<pre><code class=\"r\">txt = '\uac70\uae302 \uba85\uc774 \uc788\uc5c8\uc5b4. \uc544 \uc624\ub2983\uc2dc\uc5d0 \ubcfc\uaebc\uc9c0? \uc544 \ub9de\ub2e4 4\uc2dc\uc600\uc9c0?'\r\nstrsplit(txt, '(?&lt;=\\\\p{L})(?=\\\\d)', perl=TRUE)\r\n<\/code><\/pre>\n<pre>## [[1]]\r\n## [1] \"\uac70\uae30\"                           \"2 \uba85\uc774 \uc788\uc5c8\uc5b4. \uc544 \uc624\ub298\"         \"3\uc2dc\uc5d0 \ubcfc\uaebc\uc9c0? \uc544 \ub9de\ub2e4 4\uc2dc\uc600\uc9c0?\"\r\n<\/pre>\n<p>\ub9cc\uc57d \ube48 \uacf5\uac04\uacfc \uc22b\uc790\uac00 \uc5f0\uacb0\ub418\ub294 \uc9c0\uc810\ub3c4 \ud3ec\ud568\ud558\uace0\uc790 \ud55c\ub2e4\uba74,<\/p>\n<pre><code class=\"r\">txt = '\uac70\uae302 \uba85\uc774 \uc788\uc5c8\uc5b4. \uc544 \uc624\ub2983\uc2dc\uc5d0 \ubcfc\uaebc\uc9c0? \uc544 \ub9de\ub2e4 4\uc2dc\uc600\uc9c0?'\r\nstrsplit(txt, '(?&lt;=\\\\p{L}| )(?=\\\\d)', perl=TRUE)\r\n<\/code><\/pre>\n<pre>## [[1]]\r\n## [1] \"\uac70\uae30\"                   \"2 \uba85\uc774 \uc788\uc5c8\uc5b4. \uc544 \uc624\ub298\" \"3\uc2dc\uc5d0 \ubcfc\uaebc\uc9c0? \uc544 \ub9de\ub2e4 \" \"4\uc2dc\uc600\uc9c0?\"\r\n<\/pre>\n<h2>\uacb0\ub860<\/h2>\n<p><code>strplit<\/code>\uc758 <code>pattern<\/code>\uc73c\ub85c <code>(?&lt;= )(?= )<\/code>\uc744 \uc4f0\uba74 \ud2b9\uc815\ud55c \uc9c0\uc810\uc744 \uac00\ub9ac\ud0ac \uc218 \uc788\ub2e4. \uc774\ub54c <code>perl=TRUE<\/code>\ub85c \ud558\ub294 \uac83\uc744 \uc78a\uc9c0 \ub9d0\uc790.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>strsplit strsplit\uc740 \ubb38\uc790\uc5f4\uc744 \uc8fc\uc5b4\uc9c4 \ubb38\uc790(\uc5f4)\uc744 \uae30\uc900\uc73c\ub85c \ubd84\ub9ac\ud55c\ub2e4. \ub2e4\uc74c\uc758 \ub367\uc148\uc744 \uad6c\uc131\ud558\ub294 \ubaa8\ub4e0 \uc22b\uc790\ub97c \ubd84\ub9ac\ud574\ub0b4\uace0\uc790 \ud55c\ub2e4\uba74, txt = &#8217;32+45+33+42+ 24 + 22 + 3&#8242; strsplit(txt, &#8216; *[+] *&#8217;) ## [[1]] ## [1] &#8220;32&#8221; &#8220;45&#8221; &#8220;33&#8221; &#8220;42&#8221; &#8220;24&#8221; &#8220;22&#8221; &#8220;3&#8221; \ub2e8\uc21c\ud788 +\ub97c \uc5c6\uc560\ub294 \uac83\uc774 \uc544\ub2c8\ub77c +\uc640 \uc22b\uc790 \uc0ac\uc774\uc758 \uc2a4\ud398\uc774\uc2a4\ub3c4 \uc801\uc808\ud558\uac8c \uc5c6\uc560\uc904 \uc218 \uc788\ub2e4. \uc0ac\ub77c\uc9c4 \ubb38\uc790 \uc0ac\ub77c\uc9c4 \uae00\uc790\uac00 \uadf8\ub9ac\uc6b8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2228,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,79],"tags":[470,468,469],"jetpack_featured_media_url":"http:\/\/ds.sumeun.org\/wp-content\/uploads\/2020\/08\/rex_look_around.png","_links":{"self":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/2229"}],"collection":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2229"}],"version-history":[{"count":2,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/2229\/revisions"}],"predecessor-version":[{"id":2231,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/2229\/revisions\/2231"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/media\/2228"}],"wp:attachment":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2229"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}