タグ

regexに関するWindymeltのブックマーク (7)

  • 正規表現の名前つきキャプチャを便利にする - 貳佰伍拾陸夜日記

    Java 7から正規表現で名前つきキャプチャが使えて, Scalascala.util.matching.Regex.Matchでもそれに相当する機能がある(インタフェースや実装はJava標準のものとは別)けれど, ちょっと不便なところをどうにかしているうちに, インデックスによるキャプチャグループの上に独自に名前つきキャプチャグループを実装するような形になった. 使い方はREADMEを見てもらうとして, なぜこんなものがほしくなったのかという話を書いておく. 標準の名前つきキャプチャのよくないところ キャプチャグループの実体と名前の乖離 名前つきキャプチャは正規表現中で(?<name>pattern)のように書くことで, patternにマッチした部分をあとからnameで参照できる. たとえば, Webサーバのルーティング処理で, パス中に名前つきでパターンを書いておけば非常に便利そう

    正規表現の名前つきキャプチャを便利にする - 貳佰伍拾陸夜日記
    Windymelt
    Windymelt 2023/03/16
    公開されてたの知らなかった!!!!!!
  • 正規表現でキャプチャグループを使うときは名前を付けよう


    JS/TS ()使使 2使1.match()使 1|使使 //  const matches = "v7.29.3".match(/v(\d+)\.(\d+)\.(\d+)/); console.log(matches[1]); // => 7 console.log(matches[2]); // => 29 console.log(matches[3]); // => 3 // `Hello, world!``Goodbye, world!` const isMatch
    正規表現でキャプチャグループを使うときは名前を付けよう
    Windymelt
    Windymelt 2023/03/16
    良い記事。Scalaでもこういう記法あった気がする。
  • pcrepattern specification

    pcrepattern man page Return to the PCRE index page. This page is part of the PCRE HTML documentation. It was generated automatically from the original man page. If there is any nonsense in it, please consult the man page, in case the conversion went wrong. PCRE REGULAR EXPRESSION DETAILS SPECIAL START-OF-PATTERN ITEMS EBCDIC CHARACTER CODES CHARACTERS AND METACHARACTERS BACKSLASH CIRCUMFLEX AND DO

    Windymelt
    Windymelt 2020/07/23
    “Outside a character class, by default, the escape sequence \R matches any Unicode newline sequence”
  • んっ?−ちゃよて・ちゃよて

    We could not find anything for your request! 御要求のWebページ、画像、ファイルが見つかりません。 トップページへ サイトの内容紹介ページへ

    Windymelt
    Windymelt 2017/02/06
    regexpの構文木(ast)を作るコード
  • PHPで仮想マシンベースの正規表現エンジンを作ってみる 第一回


     使?PHP使   PHPPCRE Ruby
  • 正規表現によるバリデーションでは ^ と $ ではなく \A と \z を使おう


     ^  $  \A  \z Ruby ^  $ 使PerlPHPRuby \A  \z 使  PHPerRuby/RailsRuby ^  $ RubyonRails Security GuideXSShttphttpsURL /^https?:\/\/[^\n]+$/
    Windymelt
    Windymelt 2016/04/08
    ]これからは使っていきたい
  • regex101: build, test, and debug regex

    Please remember this entry will be public in the community library. This is not your personal regex library! To save, access and manage your personal entries, please go to the account page instead.

    regex101: build, test, and debug regex
  • 1