Skip to content
正規表現

File:Antony08.gif · Wikimedia Commons · See Wikimedia Commons

EntityQ185612· pop 70· linked from 560 articles

正規表現

Sign in to save

Also known as regex, regexp, regxp, RegExp, rational expression, Complement operator (regular expressions), regular expressions, rational expressions

文字列の集合を、ひとつの文字列で表現する方法のひとつ

AI overview

A regular expression is a sequence of characters that you can use to search for and find specific text patterns in documents or data. It matters because it lets you quickly locate, extract, or replace information without having to manually search through everything yourself.

AI-generated from the Wikipedia summary — may contain errors.

Described at

RegExr: Learn, Build, & Test RegEx

Regular expression tester with syntax highlighting, PHP / PCRE & JS Support, contextual help, cheat sheet, reference, and searchable community patterns.

regexr.com

Edit the Expression & Text to see matches. Roll over matches or the expression for details. PCRE & JavaScript flavors of RegEx are supported. Validate your expression with Tests mode. The side bar includes a Cheatsheet, full Reference, and Help. You can also Save & Share with the Community and view patterns you create or favorite in My Patterns. Explore results with the Tools below. Replace & List output custom results. Details lists capture groups. Explain describes your expression in plain English. Build a suite of tests that your expression should (or should not) match. Create new tests with the 'Add Test' button. Click a test to edit the name, type, & text. Any unsaved changes will be lost. Saved patterns & favorites will be migrated to your account.

Excerpt from a page describing this subject · 2,795 chars · not written by Vinony

Article · 日本語

正規表現(せいきひょうげん、英: regular expression)は、文字列の集合を一つの文字列で表現する方法の一つである。正則表現(せいそくひょうげん)とも呼ばれ、形式言語理論の分野では比較的こちらの訳語の方が使われる。まれに正則式(せいそくしき)あるいは正規式(せいきしき)と呼ばれることもある。 もともと正規表現は形式言語理論において正規言語を表すための手段として導入された。形式言語理論では、形式言語が正規言語であることと正規表現によって表せることは同値である。 その後正規表現は単機能の文字列探索ツールやテキストエディタ、ワードプロセッサなどのアプリケーションで、マッチさせるべき対象を表すために使用されるようになり、表せるパターンの種類を増やすために本来の正規表現にはないさまざまな記法が新たに付け加えられた。このような拡張された正規表現には正規言語ではない文字列も表せるものも多く、ゆえに正規表現という名前は実態に即していない面もあるが、伝統的に正規表現と呼ばれ続けている。 この記事では主にこのような正規表現を用いたパターンマッチングについて説明している。以下、誤解のない限り、アプリケーションやプログラミングにおいて正規表現を用いた文字列のパターンマッチングを行う機能のことを、単に正規表現という。 ほとんどのプログラミング言語では、ライブラリによって正規表現を使うことができる他、一部の言語では正規表現のリテラルもある。「正規表現によるマッチ」を意味する(専用の)演算子がある言語なども一部ある。具体例として、grep, AWK, sed, Perl, Tcl, lex などがある。 それぞれの言語やアプリケーションで細部の仕様が異なっている、といったように思われることも多いが(古い実装では実際にそのようなことも多い)、近年は同じライブラリを使っていれば同じということも多い。またPOSIXなど標準もある。

Abstract from DBpedia / Wikipedia · CC BY-SA

Gallery (3)