タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

programmingとregexに関するkitsのブックマーク (4)

  • プログラミング言語における正規表現リテラルの必要性について

    Twitterに書いたことのまとめです。 プログラミング言語の仕様の一部として正規表現リテラルを提供することの得失について、JavaScriptを例に説明します。 ■より簡潔なコード 言うまでもありませんが、正規表現リテラルを使った方が簡潔なコードになります。 (new RegExp("abc")).exec(s) // リテラルを使わない場合 /abc/.exec(s) // リテラルを使った場合 また、正規表現リテラルがない場合は、文字列リテラルとしてのエスケープと正規表現としてのエスケープが二重に必要になる結果、コードの保守性が低下します注1。 new RegExp("\\\\n"); // リテラルを使わない場合 /\\n/ // リテラルを使った場合 ■エラー検出タイミング 正規表現リテラルがない場合、実際にその正規表現が評価されるまで記述エラーを検出することができません。正規表

    kits
    kits 2013/12/18
    コードが簡潔、コンパイル時にエラー
  • 正規表現が構文として必要かどうかという話から

    FUJI Goro @__gfx__ dartVMはほんとに速くなったし、標準化はほんとに期待してる。あと正規表現さえ構文に組み込まれればサーバーサイドでも使えますよこれは。 2013-12-15 22:04:54 methane @methane @__gfx__ なんでサーバーサイドで使うのに正規表現が構文で必要なんですか…? PythonGo も正規表現構文無いけど不自由感じないし、むしろリテラルあるとシンプルな文字列操作で良い場面で正規表現を使う悪習が広まるので良くないと思うのですが。 2013-12-15 22:43:35

    正規表現が構文として必要かどうかという話から
  • gkbr.me

    このドメインを購入する。 gkbr.me 2018 Copyright. All Rights Reserved. The Sponsored Listings displayed above are served automatically by a third party. Neither the service provider nor the domain owner maintain any relationship with the advertisers. In case of trademark issues please contact the domain owner directly (contact information can be found in whois). Privacy Policy

    kits
    kits 2010/11/15
    href属性抜き出しとかで前後の引用符の対応がちゃんとしてなかったりするものがある( href="foo'bar" でfooしか取れないとか)。粗製濫造にならないか心配。
  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

  • 1