regular expressions: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Examples: reAnimator
wikipedia
Line 12: Line 12:
** matches at least 6 links in a row with nothing except spaces between them; good for detecting spam
** matches at least 6 links in a row with nothing except spaces between them; good for detecting spam
==Links==
==Links==
===Reference===
* {{wikipedia|Regular expression}}
===Posts===
* '''2006-02-19''' [http://osteele.com/archives/2006/02/reanimator Visualizing Regular Expressions]: blog entry by the author of reAnimator, a regex implementation visualizer
* '''2006-02-19''' [http://osteele.com/archives/2006/02/reanimator Visualizing Regular Expressions]: blog entry by the author of reAnimator, a regex implementation visualizer

Revision as of 23:48, 22 November 2009

computing: software: programming: regex

Overview

Regex is shorthand for "Regular Expressions", a syntax used in string matching and replacement. It is especially heavily used in Perl, and the Linux utility grep is basically a front end for regex geared towards file-searching.

Articles

Examples

  • \[http://[a-z|0-9|\.|\-]+\.[a-z|0-9|.|\-]+[a-z|0-9|\.|\-\/]* [a-z|0-9| ]+\]( )*
    • matches a link in MediaWiki markup (it could probably be more precise, but catches most of them)
  • (\[http://[a-z|0-9|\.|\-]+\.[a-z|0-9|.|\-]+[a-z|0-9|\.|\-\/]* [a-z|0-9| ]+\]( )*){5,}
    • matches at least 6 links in a row with nothing except spaces between them; good for detecting spam

Reference

Posts