Talk:Regular expression: Difference between revisions
m Signing comment by 106.51.151.241 - "→Which algorithm is working behind REGEX...: new section" |
|||
Line 24: | Line 24: | ||
::That excludes things like "rotomcar", e.g., any permutation of m/o/t/r/ [[User:Tedickey|TEDickey]] ([[User talk:Tedickey|talk]]) 00:12, 18 April 2012 (UTC) |
::That excludes things like "rotomcar", e.g., any permutation of m/o/t/r/ [[User:Tedickey|TEDickey]] ([[User talk:Tedickey|talk]]) 00:12, 18 April 2012 (UTC) |
||
:::You can express this using a regular expression like "'''([^m]otor|^otor|[^o]tor|^tor|[^t]or|^or|[^o]r|^r|[^r]|^)(car)'''" or "'''((((([^m]|^)o|[^o]|^)t|[^t]|^)o|[^o]|^)r|[^r]|^)(car)'''" — tedious to type, but still polynomial (the latter even linear) in length with respect to the original words ("motor" and "car"). In Perl or Java etc., you can simply write "'''(?<!motor)car'''". [[Special:Contributions/90.190.113.12|90.190.113.12]] ([[User talk:90.190.113.12|talk]]) 16:05, 22 February 2013 (UTC) |
|||
== Move formal definition to end == |
== Move formal definition to end == |
Revision as of 16:05, 22 February 2013
This is the talk page for discussing improvements to the Regular expression article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
Archives: 1, 2Auto-archiving period: 90 days |
Computing C‑class High‑importance | ||||||||||
|
Computer science C‑class High‑importance | |||||||||||||||||
|
|
||
This page has archives. Sections older than 90 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
Text and/or other creative content from this version of Regular expression examples was copied or moved into Regular expression with this edit on 22:28, 9 January 2012. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
Problem with "not preceded by"?
One of the examples given is:
* the word "car" when not preceded by the word "motor"
Then it says "These examples are simple."
I don't think that's a simple example - in fact I can't think of a way to match that. Either I'm being dim (quite possible) or that example should be removed. Jj Banana (talk) 15:12, 13 February 2012 (UTC)
- Doesn't "[^motor]car" work? -- Technical 13 (talk) 23:30, 17 April 2012 (UTC)
- That excludes things like "rotomcar", e.g., any permutation of m/o/t/r/ TEDickey (talk) 00:12, 18 April 2012 (UTC)
- You can express this using a regular expression like "([^m]otor|^otor|[^o]tor|^tor|[^t]or|^or|[^o]r|^r|[^r]|^)(car)" or "((((([^m]|^)o|[^o]|^)t|[^t]|^)o|[^o]|^)r|[^r]|^)(car)" — tedious to type, but still polynomial (the latter even linear) in length with respect to the original words ("motor" and "car"). In Perl or Java etc., you can simply write "(?<!motor)car". 90.190.113.12 (talk) 16:05, 22 February 2013 (UTC)
Move formal definition to end
I think that the formal definition should be moved to the end of the article. Most of the people accessing this article want to see some example. Therefore the article should present the examples first and the formal definition later. — Preceding unsigned comment added by 89.23.239.59 (talk) 18:19, 25 March 2012 (UTC)
Regex as C standard library
It is said in the article that: "For yet other languages, such as Object Pascal(Delphi) and C and C++, non-core libraries are available"...
But regex does actually exist as a C core library; "man regex" gives me that on BSD OS:
REGEX(3) BSD Library Functions Manual REGEX(3)
NAME
regcomp, regerror, regexec, regfree -- regular-expression library
LIBRARY
Standard C Library (libc, -lc)
69.80.96.81 (talk) 04:48, 28 May 2012 (UTC)
- The term "core library" means whether it is part of the C language standard (or analogous POSIX standards), not whether some system happens to store the feature in libc. It is easy to find nonstandard functions in most libc's TEDickey (talk) 09:28, 28 May 2012 (UTC)
Citation for original popularity of regular expressions following success of 'ed' and 'grep'
The third sentence of the article is flagged {citation needed}, but I don't know how to fix this within the article.
I would like to suggest this reference:
"Mastering Regular Expressions, 2nd Edition from O'Reilly, by Jeffrey E. F. Friedl; Chapter 3 "Overview of Regular Expression Features and Flavors", page 85, under the heading "The Origins of Regular Expressions", third and fourth paragraphs:
"Although there is evidence of earlier work, the first published computational use of regular expressions I have actually been able to find is Ken Thompson's 1968 article Regular Expression Search Algorithm in which he describes a regular-expression compiler that produced IBM 7094 object code. This led to his work on qed, an editor that formed the basis for the Unix editor ed.
ed's regular expressions were not as advanced as those in qed, but they were the first to gain widespread use in non-technical fields. ed had a command to display lines of the edited file that matched a given regular expression. The command, "g/Regular Expression/p", was read "Global Regular Expression Print." This particular function was so useful that it was made into its own utility, grep (after which egrep--extended grep--was later modeled."
--hope this helps leeeoooooo [002012-06-05] — Preceding unsigned comment added by Leeeoooooo (talk • contribs) 01:12, 6 June 2012 (UTC)
- Have this book too and was actually planning to use the above quote as a citation. The book is well researched and would say written by someone who know regular expression very well. So I am hoping no one would object to us using the above book as a citation. 24.212.138.15 (talk) That was me gathima (talk)
The document http://genius.cat-v.org/brian-kernighan/articles/beautiful suggests the same:
"Regular expressions first appeared in a program setting in Ken Thompson's version of the QED text editor in the mid-1960's. In 1967, Ken applied for a patent on a mechanism for rapid text matching based on regular expressions; it was granted in 1971, one of the very first software patents [US Patent 3,568,156, Text Matching Algorithm, March 2, 1971]. [...] Regular expressions moved from QED to the Unix editor ed, and then to the quintessential Unix tool, grep, which Ken created by performing radical surgery on ed."
Also, roughly the same text appears in the book "Beautiful Code: Leading Programmers Explain How They Think" (the above link is a draft).
70.82.120.78 (talk) 19:23, 15 August 2012 (UTC)
Which algorithm is working behind REGEX...
What is the pattern matching algorithm which is actually working at the ground level is it 1. KMP Matching Technique 2. Rabin Karp... Questions araised since the Text is converted internally into char array and the pattern is matched over that.... — Preceding unsigned comment added by 106.51.151.241 (talk) 15:16, 2 December 2012 (UTC)