Regular expression visualizer using railroad diagrams
In 1987, Rob Pike wrote about Structural Regular Expressions, a command language for the text editor sam. The name is a little misleading as it is not the regular expressions which are structural but the commands themselves, which augment the standard ed language with loops and conditionals. For example, the command x/.*\n/g/foo/p will print all lines which contain the string “foo” — x will first
正規表現と構文図について解説します。オートマトンについても詳しく述べます。オートマトン・スゴロクで遊びましょう! 世間でよく知られている/使われている概念・方法にはこだわらず、僕(檜山)の感覚で一番わかりやすいと思われる筋書きと用語法/図式法を使って説明します。この記事に目を通して“感じ”が掴めたら、形式言語理論の教科書を読み始めることが出来るでしょう。 [追記]この記事の内容に対する具体例は、「正規表現とオートマトン:なんだ簡単じゃん、JavaScriptによる実装」にあります。[/追記] 内容: 正規表現 正規表現の例 構文図 基本記号 連接 選択 省略可能 繰り返し ストレートワイヤーによるレイアウト調整 有限状態オートマトン 有限状態オートマトンの実行 バックトラックと先読み スゴロクとオートマトン コマをたくさん使うスゴロクと並列処理 非決定性オートマトンと決定性オートマトン 正
なんか動かしてるプログラムのとある関数がやたら重い。 DProfセンセ〜イ!! %Time ExclSec CumulS #Calls sec/call Csec/c Name 59.3 36.62 38.237 1 36.621 38.236 Omokute::Tamaran::Function 19.6 12.10 15.161 15223 0.0008 0.0010 utf8::SWASHGET ぎゃあ。激重いがな!utf8::SWASHGET。 で、正規表現を使う際に内部的に呼ばれているらしいけど、 ちょっと重すぎ。 http://www.nntp.perl.org/group/perl.unicode/2807 によると、 Unicode含まない正規表現使うときは、 そこだけスコープ切って、その中でuse bytesを指定してあげな! だそうです。 めんどい。 しかも日本語での情
NAME Graph::Regexp - Create graphical flowchart from a regular expression SYNOPSIS # print out ASCII graph perl -Mre=debug -e '/just|another|perl|hacker/' 2>&1 | examples/regraph # the same, as PNG rendered via dot perl -Mre=debug -e '/me|you/' 2>&1 | examples/regraph as_graphviz | dot -Tpng -o me.png DESCRIPTION This module takes the debug dump of a regular expression (regexp) as generated by Per
2007年04月19日15:00 カテゴリLightweight Languages perl - Regexp::Assembleのススメ というわけで、Regexp::Assembleのご紹介。 PERL HACKS(日本語版) [英語版] odz buffer - それ Regexp::Assembleん?ループ云々を抜きにして、こういうのは Regexp::Assemble の出番じゃないの? すでにPerl Hackers御用達のモジュールとなっていますが、まだ知らない方もいらっしゃるかも知れないので。 何をするモジュールか、といえば、以下を見れば一目瞭然でしょう。 Regexp::Assemble - Assemble multiple Regular Expressions into a single RE - search.cpan.org use Regexp::Asse
This domain may be for sale!
Emacs で正規表現を使うならば re-builder を使うことをおすすめします。 例えば、正規表現を良く使うシチュエーションとして置換があります。 M-x replace-regexpで置換対象文字列を正規表現で指定し、何に置換して欲しいかを指定するわけです。 行頭に // を追加してソースをコメントアウトしたいのであれば M-x replace-regexp Replace regexp: ^ ← ^ を入力 Replace regexp ^ with: // ← // を入力のように置換をします。(この場合は、comment-region が最適解ですが) 例に挙げたような簡単な正規表現であれば、間違いようもなく問題ないのですが、ちょっと複雑な置換になると話は変わります。 以下のようなコードがあるとしましょう。 byte* buf = new byte[32]; unsigned
ぶくま経由で、RFC 3986 URI の日本語訳にたどり着き、読んでいました。スムーズな日本語ですんなりと読めて、良い訳だと思いました。私は誤訳を見つけられませんでした。 それはともかく、読んでいる最中に、RFC3986 だけではないのですが、IPv4 アドレスの数字にマッチする構文が、正規表現向けでないのに改めて気になりました。RFC の記述をそのまま正規表現にすると、バックトラックをおこす書き方になっています。 バックトラックがおきないようにするには、先頭から1文字ずつ見ていくだけで残りの選択肢のどれに進めばいいか決定できるようにすればよろしい。ということで、これをテスト駆動で正規表現に向いた記述に変更してみました。 ⇒ http://www.studyinghttp.net/cgi-bin/rfc.cgi?3986#Sec3.2.2 IPv4address = dec-octet
NAME Regexp::Trie - builds trie-ized regexp SYNOPSIS use Regexp::Trie; my $rt = Regexp::Trie->new; for (qw/foobar fooxar foozap fooza/){ $rt->add($_); } print $rt->regexp, "\n" # (?-xism:foo(?:bar|xar|zap?)) DESCRIPTION This module is a faster but simpler version of Regexp::Assemble or Regexp::Optimizer. It builds a trie-ized regexp as above. This module is faster than Regexp::Assemble but you can
NAME Regexp::Assemble - Assemble multiple Regular Expressions into a single RE SYNOPSIS use Regexp::Assemble; my $ra = Regexp::Assemble->new; $ra->add( 'ab+c' ); $ra->add( 'ab+-' ); $ra->add( 'a\w\d+' ); $ra->add( 'a\d+' ); print $ra->re; # prints a(?:\w?\d+|b+[-c]) DESCRIPTION Regexp::Assemble takes an arbitrary number of regular expressions and assembles them into a single regular expression (or
借金をしたときには、必ず返済しなければなりません。 多くの人がそのまま頑張って返さなければと考えがちですが、賢い借金返済方法を取ることでより楽に返せるようになるのです。
Welcome to Regular-Expressions.info The Premier website about Regular Expressions A regular expression (regex or regexp for short) is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. The regex equivalent is ^.*\.txt$. But you
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く