タグ

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

タグの絞り込みを解除

Programmingと正規表現に関するokagawaのブックマーク (3)

  • d.y.d. 正規表現にマッチする例をランダム生成

    15:43 07/05/17 正規表現にマッチする例 soutaroさんの 正規表現にマッチする例をランダム生成 する話を見てたら、 自分でも書きたくなってきました。というわけでソース。 正規表現を構文解析してオートマトンに コンパイルしてから、その上を似非ランダムウォークしてます。対応してる正規表現は ?と+と*と|と.と[…]だけです。[…]の中の-とか^とかにも反応しません。あと IE と Rhino でしかチェックしてないので他の環境で動かなかったらゴメンナサイ。 きっともっとマトモなのをsoutaroさんが公開されるはずです。 ボタンを押したらこの上↑に10個例が生成されるはず。 で、動かしてみて思ったのは、当たり前だけど繰り返しが長続きしないなー、と。 確かに、ループをちゃんと意識しないと面白い結果にならないかもしれないですね。 なるほど。 追記12:15 07/05/18 ぎ

  • Regular Expression Matching Can Be Simple And Fast

    Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, ...) Russ Cox rsc@swtch.com January 2007 Introduction This is a tale of two approaches to regular expression matching. One of them is in widespread use in the standard interpreters for many languages, including Perl. The other is used only in a few places, notably most implementations of awk and grep.

  • How Regexes Work

    Mark-Jason Dominus Copyright © 1998 The Perl Journal. Reprinted with permission. This isn't an article about how to use regexes; you've probably seen plenty of those already. It's about how you would write a regex package from scratch, in a language like C that doesn't already have regexes. I'll demonstrate a new module, Regex.pm, which implements regexes from nothing, in Perl. This will give you

  • 1