For more information, see the section on flags in “Exploring JavaScript”. The remaining flags are not supported because they would either make regular expression semantics too complicated (e.g. flag v) or because they only make sense if applied to the whole regular expression (e.g. flag g). What are the use cases for pattern modifiers? # Use case: changing flags for part of a regular expression
Although JavaScript regexes used to be underpowered compared to other modern flavors, numerous improvements in recent years mean that’s no longer true. Steven Levithan evaluates the history and present state of regular expressions in JavaScript with tips to make your regexes more readable, maintainable, and resilient. Modern JavaScript regular expressions have come a long way compared to what you
RE2 is a regular expression engine designed to operate in time proportional to the size of the input, ensuring linear time complexity. RE2JS, on the other hand, is a pure JavaScript port of the RE2 library — more specifically, it's a port of the RE2/J library. JavaScript standard regular expression package, RegExp, and many other widely used regular expression packages such as PCRE, Perl and Pytho
I first heard about regular expression denial of service (ReDoS) vulnerabilities from GitHub's Dependabot. Several of my projects over the years have had dependencies that suffered from ReDoS vulnerabilities, and I would bet that if you've built any JavaScript project with dependencies, you've also come across this. This got me thinking; if there are vulnerable regular expressions in our dependenc
Over the last several years, I’ve rewritten Rust’s regex crate to enable better internal composition, and to make it easier to add optimizations while maintaining correctness. In the course of this rewrite I created a new crate, regex-automata, which exposes much of the regex crate internals as their own APIs for others to use. To my knowledge, this is the first regex library to expose its interna
grex is a library that is meant to simplify the often complicated and tedious task of creating regular expressions. It does so by automatically generating a single regular expression from user-provided test cases. The resulting expression is guaranteed to match the test cases which it was generated from. This project has started as a Rust port of the JavaScript tool regexgen written by Devon Govet
ECMAScript proposal: RegExp flag /v makes character classes and character class escapes more powerful In this blog post, we look at the ECMAScript proposal “RegExp v flag with set notation + properties of strings” by Markus Scherer and Mathias Bynens. The new flag /v # The proposed new regular expression flag /v (.unicodeSets) enables three features: Support for multi-code-point graphemes (such a
はじめに 正規表現が文字列にマッチするかどうかを判定するプログラムを作るにあたっては、以前の記事で紹介したようにVMを用いたり、または正規表現と等価なオートマトンを用いたりする。この記事ではこれらとは別の方法として「正規表現の微分(regular expression derivative)」を用いた方法について説明し、さらにこの方法を使うことで今までの方法では触れていなかった、正規表現のある一部にマッチした文字列を抽出するサブマッチングについても紹介する。 また、この記事で紹介するコードは次のGitHubリポジトリから入手できる。 https://github.com/y-yu/PosixRegex 正規表現の抽象構文木 まずは、正規表現の抽象構文木を表す代数的データ型を次のように定義する。 sealed trait Regex object Regex { case class Var
grex is a library as well as a command-line utility that is meant to simplify the often complicated and tedious task of creating regular expressions. It does so by automatically generating a single regular expression from user-provided test cases. The resulting expression is guaranteed to match the test cases which it was generated from. This project has started as a Rust port of the JavaScript to
PerlにはRegexp::Assembleという便利なライブラリがあります。 複数の正規表現を受け取り、それらのいずれかにマッチする正規表現を構築するためのライブラリです。 my $ra = Regexp::Assemble->new; $ra->add( 'ab+c' ); $ra->add( 'ab+\\d*\\s+c' ); $ra->add( 'a\\w+\\d+' ); $ra->add( 'a\\d+' ); print $ra->re; # prints (?:a(?:b+(?:\d*\s+)?c|(?:\w+)?\d+)) このライブラリのGo実装を金曜日の夜から書き始めて、ようやく形になってきたので公開しました。 package main import ( "fmt" "log" "github.com/itchyny/rassemble-go" ) func main
# その正規表現エンジン、<br /><span class="narrow"><span>イ</span><span>ン</span><span>タ</span><span>プ</span><span>リ</span><span>タ</span></span>で<ruby>満足<rp>(</rp><rt>サティスファイ</rt><rp>)</rp></ruby>してる?! ---------------------- [Regex Festa - connpass](https://opt.connpass.com/event/140566/) === # About Me ---------  * κeen * [@blackenedgold](https://twitter.com/blackenedgold) * Git
僕の所属する研究室では毎年Software Foundationsの輪講をやっているんですが,Brzozowski derivativeに基づいて正規表現エンジンを実装し,あまつさえCoqで検証してしまおうといった練習問題が追加されていて大変興味深かったです. 折角practicalなプログラムを書いたのにCoqの中に閉じ込めておくのも勿体ないですし, OCamlで同様の正規表現エンジンを実装し,実行速度を見てみようと思います. *1 2018/12/16 Brzozowski derivativeの定義に誤りがあったため修正 Brzozowski derivativeとは? ある正規表現が受理する言語の先頭から,文字を取り除いて得られる言語 *2を受理する正規表現をBrzozowski derivativeといい,以下のようにsystematicに求められます. ある正規表現が空文字列を
Support for regular expressions was added to ECMAScript 3 in 1999. Sixteen years later, ES6/ES2015 introduced Unicode mode (the u flag), sticky mode (the y flag), and the RegExp.prototype.flags getter. This article highlights what’s happening in the world of JavaScript regular expressions right now. Spoiler: it’s quite a lot — there are more RegExp-related proposals currently advancing through the
In this article we’ll take a look at regular expressions in and after ES6. There’s a couple of regular expressions flags which were introduced in ES6: the /y or sticky flag, and the /u or Unicode flag. Then we’ll discuss five proposals which are making their way through the ECMAScript specification development process at TC39. Sticky Matching Flag /y The sticky matching y flag introduced in ES6 is
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く