{"id":120210,"date":"2024-03-28T12:04:20","date_gmt":"2024-03-28T03:04:20","guid":{"rendered":"https:\/\/softantenna.com\/blog\/?p=120210"},"modified":"2024-03-28T12:04:20","modified_gmt":"2024-03-28T03:04:20","slug":"regex-line-anchors","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/regex-line-anchors\/","title":{"rendered":"\u6b63\u898f\u8868\u73fe\u304c\"$\"\u3068\"^\"\u3092\u30e9\u30a4\u30f3\u30a2\u30f3\u30ab\u30fc\u3068\u3057\u3066\u63a1\u7528\u3057\u305f\u7406\u7531"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2024\/03\/1f684a60-30f4-400f-a283-cb3ecf432fdb.jpg\" alt=\"1f684a60 30f4 400f a283 cb3ecf432fdb\" title=\"1f684a60-30f4-400f-a283-cb3ecf432fdb.jpg\" border=\"0\" width=\"956\" height=\"507\" \/><\/p>\n<p>\u300c\u6b63\u898f\u8868\u73fe\u300d\u306f\u3055\u307e\u3056\u307e\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u5229\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u6b63\u898f\u8868\u73fe\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u300c\u8a18\u53f7\u300d\u304c\u3069\u306e\u3088\u3046\u306b\u9078\u3070\u308c\u305f\u306e\u304b\u4e0d\u601d\u8b70\u306b\u601d\u3063\u3066\u3044\u308b\u65b9\u3082\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u4eca\u56de\u3001\u6b63\u898f\u8868\u73fe\u306e\"$\"\u3068\"^\"\u304c\u884c\u672b\u30fb\u884c\u982d\u3092\u793a\u3059\u30e9\u30a4\u30f3\u30a2\u30f3\u30ab\u30fc\u3068\u3057\u3066\u9078\u3070\u308c\u305f\u7406\u7531\u3092\u63a8\u6e2c\u3059\u308b\u30d6\u30ed\u30b0\u8a18\u4e8b\u3001\u300c<a href=\"https:\/\/buttondown.email\/hillelwayne\">Why do regexes use `$` and `^` as line anchors?<\/a>\u300d\u304c\u516c\u958b\u3055\u308c\u6ce8\u76ee\u3092\u96c6\u3081\u3066\u3044\u307e\u3059(<a href=\"https:\/\/www.reddit.com\/r\/programming\/comments\/1bokrll\/why_do_regexes_use_and_as_line_anchors\/\">Reddit<\/a>)\u3002<\/p>\n<p>\u8a18\u4e8b\u3092\u4f5c\u6210\u3057\u305f\u30b3\u30f3\u30b5\u30eb\u30bf\u30f3\u30c8\u306eHillel Wayne\u6c0f\u306b\u3088\u308b\u3068\u3001\u6b63\u898f\u8868\u73fe\u304c\u6700\u521d\u306b\u767b\u5834\u3057\u305f\u306e\u306fKen Thompson\u6c0f\u304c\u79fb\u690d\u3057\u305fQED\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3060\u3068\u306e\u3053\u3068\u3067\u3059\u3002\u79fb\u690d\u7248\u306eQED\u30a8\u30c7\u30a3\u30bf\u306e\u30de\u30cb\u30e5\u30a2\u30eb\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u60c5\u5831\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote><p>\nb) \"^\" is a regular expression which matches character at the beginning of a line.<\/p>\n<p>c) \"$\" is a regular expression which matches character before the character <nl> (usually at the end of a line)<\/p>\n<p>b) \"^\"\u306f\u3001\u884c\u982d\u306e\u6587\u5b57\u306b\u30de\u30c3\u30c1\u3059\u308b\u6b63\u898f\u8868\u73fe\u3067\u3042\u308b\u3002<\/p>\n<p>c) \"$\" \u306f\u3001\u6587\u5b57 <nl> \u306e\u524d (\u901a\u5e38\u306f\u884c\u672b) \u306e\u6587\u5b57\u306b\u30de\u30c3\u30c1\u3059\u308b\u6b63\u898f\u8868\u73fe\u3067\u3042\u308b\u3002\n<\/p><\/blockquote>\n<p>QED\u306fed\u306e\u524d\u8eab\u3068\u306a\u308b\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3067\u3001ed\u306f\u6b63\u898f\u8868\u73fe\u306e\u666e\u53ca\u306b\u8ca2\u732e\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002Ken Thompson\u6c0f\u304c\u6b63\u898f\u8868\u73fe\u3067\u3053\u308c\u3089\u306e\u6587\u5b57\u3092\u63a1\u7528\u3057\u305f\u7406\u7531\u306b\u3064\u3044\u3066\u3001\u6b21\u306e\u3088\u3046\u306b\u63a8\u6e2c\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u884c\u672b\u306e\"$\"\u306b\u95a2\u3057\u3066\u306f\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u306eQED\u30a8\u30c7\u30a3\u30bf\u306b\u6b63\u898f\u8868\u73fe\u306f\u306a\u304b\u3063\u305f\u3082\u306e\u306e\u3001$\u304c\u300c\u30d0\u30c3\u30d5\u30a1\u306e\u7d42\u308f\u308a\u300d\u3092\u793a\u3059\u8a18\u53f7\u3068\u3057\u3066\u4f7f\u308f\u308c\u3066\u3044\u3066\u3001Ken\u6c0f\u304c\u884c\u672b\u3092\u610f\u5473\u3059\u308b\u8a18\u53f7\u3068\u3057\u3066\u63a1\u7528\u3057\u305f\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u30d0\u30c3\u30d5\u30a1\u306e\u7d42\u308f\u308a\u3068\u3057\u3066$\u304c\u63a1\u7528\u3055\u308c\u305f\u7406\u7531\u3068\u3057\u3066\u306f\u5f53\u6642\u306e\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u74b0\u5883\u304c\u3042\u3052\u3089\u308c\u3066\u3044\u307e\u3059\u3002QED\u306fSDS-930\u30e1\u30a4\u30f3\u30d5\u30ec\u30fc\u30e0\u7528\u306b\u66f8\u304b\u308c\u305f\u3082\u306e\u3067\u3001SDS-930\u306f\u5165\u529b\u88c5\u7f6e\u3068\u3057\u3066\u30c6\u30ec\u30bf\u30a4\u30d735\u578b\u3092\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u3002\u3053\u306e\u30ad\u30fc\u30dc\u30fc\u30c9(\u4e0a\u8a18\u753b\u50cf)\u306b\u306f\u4f7f\u3048\u308b\u8a18\u53f7\u304c\u5c11\u306a\u304f\u3001\u30d3\u30b8\u30cd\u30b9\u3067\u975e\u5e38\u306b\u91cd\u8981\u3067\u3001\u30bf\u30a4\u30d7\u30e9\u30a4\u30bf\u30fc\u3067\u3082\u5fc5\u305a\u5229\u7528\u3067\u304d\u305f$\u304c\u63a1\u7528\u3055\u308c\u305f\u306e\u306f\u81ea\u7136\u306a\u3053\u3068\u3060\u3068\u8003\u3048\u3089\u308c\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>\u4e00\u65b9\u3001\u884c\u982d\u306e\"^\"\u306f\u30aa\u30ea\u30b8\u30ca\u30eb\u7248\u306b\u306f\u5b58\u5728\u305b\u305a\u3001Ken\u6c0f\u306e\u30ad\u30fc\u30dc\u30fc\u30c9\u3067^\u304c\u5229\u7528\u3067\u304d\u305f\u3053\u3068\u304c\u305d\u306e\u7406\u7531\u3060\u3068\u63a8\u6e2c\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u6642\u671f\u306f\u30ad\u30fc\u30dc\u30fc\u30c9\u304cASCII\u5bfe\u5fdc\u3092\u59cb\u3081\u305f\u3053\u308d\u3067\u3001^\u306fASCII-67\u306b\u767a\u97f3\u8a18\u53f7\u3068\u3057\u3066\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u30d6\u30ed\u30b0\u8a18\u4e8b\u306e\u60c5\u5831\u306f\u63a8\u6e2c\u306b\u57fa\u3065\u304f\u3082\u306e\u3067\u3059\u304c\u3001\u4f55\u304b\u6df1\u6df5\u306a\u7406\u7531\u304c\u3042\u3063\u305f\u308f\u3051\u3067\u306f\u306a\u304f\u3001\u300c\u4f7f\u3048\u308b\u8a18\u53f7\u3060\u304b\u3089\u4f7f\u3063\u305f\u300d\u3068\u3044\u3046\u5358\u7d14\u306a\u7406\u7531\u3060\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u6b63\u898f\u8868\u73fe\u300d\u306f\u3055\u307e\u3056\u307e\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u5229\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u6b63\u898f\u8868\u73fe\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u300c\u8a18\u53f7\u300d\u304c\u3069\u306e\u3088\u3046\u306b\u9078\u3070\u308c\u305f\u306e\u304b\u4e0d\u601d\u8b70\u306b\u601d\u3063\u3066\u3044\u308b\u65b9\u3082\u3044\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 \u4eca\u56de\u3001\u6b63\u898f\u8868\u73fe\u306e\"$\"\u3068\"^\"\u304c\u884c\u672b\u30fb\u884c\u982d [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":120211,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[1245],"class_list":["post-120210","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-regex"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/120210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=120210"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/120210\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/120211"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=120210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=120210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=120210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}