Talk:Regular expression examples

Not titled well
This page contains examples of perl regular expressions. There are many other kinds! Perl isn't the first, most common, or only language that supports regexes... sed, for example, probably has a larger installed base and certainly was written long before perl.

It's like we made a page that showed nothing but Ford F-150 pickups and titled it "Examples of motorized vehicles". It's not entirely wrong, yet very misleading to anyone who is not already an expert. —Preceding unsigned comment added by 205.153.180.229 (talk) 17:14, 3 May 2011 (UTC)

The last paragraph
The last paragraph: The 'm' in the above regular expressions, for example m/[^abc]/, is not required in order for perl to recognize the expression as a 'match' (cf. 'substitute': s/a/b/); /[^abc]/ could just as easily be used without the preceding 'm'. The 'm' operator can be used to alter the delimiting character; for example, m{/} may be used to enhance the legibility of patterns such as /\//. See 'perldoc perlre' for more details. needs improvement.

Synchronization with wikibook article
This article should probably be synchronized with http://en.wikibooks.org/wiki/Programming:Perl_Regular_expressions_reference

last example wrong
The last example is wrong, as of 09 Mar 2006. --Jidanni 2006-04-16
 * It worked fine for me:

$ cat pt $string1 = "Hello World\n"; if ($string1 =~ m/[^abc]/) { print "$string1 does not contain the characters "; print "a, b, and c\n"; }

$ perl pt Hello World does not contain the characters a, b, and c
 * -- Unixguy 15:45, 18 April 2006 (UTC)

No, it actually is wrong. Try it with the string "What do you mean?", and even though that string contains "a" (twice), it'll still say "does not contain the characters a, b, and c". The problem is that the regex is matching "any string that contains at least one character that isn't a, b, or c", not "the entire string consists of characters other than a, b, and c". So the message isn't the same as the regex. --Randal L. Schwartz 17:42, 20 April 2006 (UTC)
 * Thanks for the explanation, Randal. I see that -Barry- has fixed the message to be accurate, as you indicated. --Unixguy 11:13, 25 April 2006 (UTC)

WP_TPA_Upgrade: Going to add to this article to address some deficiencies
If you have questions, please see WP:TPA and note:
 * has a good title;
 * starts with a clear description;
 * is nearly self-contained; and
 * is clear

Some change is appropriate to ensure this article does not come under attack as being unencyclopedic, non-notable or otherwise not providing sufficient context to justify a stand-alone article. dr.ef.tymac 14:03, 31 March 2007 (UTC)

Follow-up: Changed to a redir to "Regular expression examples" to further preempt potential "notability" attacks. Perl is still the basis for the examples, but now the article indicates that the examples may also be translated to other languages or libraries. dr.ef.tymac 15:49, 31 March 2007 (UTC)

What's the point of this article?
This article currently offers nothing that isn't found on a thousand other simple regex tutorial pages and help files. Plus, it is Perl specific. Why does this article even exist? --Monger 00:15, 1 September 2007 (UTC)
 * In fact, the section Regular expression has been tagged as requiring expansion. Perhaps some of this should go there without what is Perl specific and this article be moved to Wikibooks. --Xosé 13:26, 21 September 2007 (UTC)
 * The sectstub template was previously added to that section by me. What from this page could possibly be moved there? It is nothing more than a basic, Perl-specific regex syntax guide. dr.ef.tymac's previously noted concerns about this article coming under attack for being unencyclopedic and non-notable were well founded. Those terms decribe this page pretty accurately, and IMHO this article should simply be deleted. --Monger 00:42, 24 September 2007 (UTC)
 * Honestly, I haven't found a more useful page on understanding how to practically use regex. I know this isn't technically a "encyclopedic" article. But it's the best resource I have found on the web. Can that be taken into consideration (it's actually useful!) —Preceding unsigned comment added by 192.75.165.28 (talk) 15:03, 2 January 2008 (UTC)
 * Perhaps an editor who believes the content is useful (I don't) can move it to Wikibooks. There is any amount of useful content that is not well suited for Wikipedia. I've just nominated this article for deletion. You are of course welcome to participate in the process. --Monger (talk) 02:33, 3 January 2008 (UTC)
 * I like the article and it is useful for me, but I need to see the output of every example. Call me stupid if you want.
 * The article should be written in pseudocode, without any programming knowledge required; this article is of no value to a mathematician or formal linguist whose interest in regular expressions is as an equivalent and efficient rewriting method for descriptions of formal languages. The fact that knowledge of Perl (in fact any programming language) is assumed is narrow-minded and prejudiced in favour of one type of relevant specialist at best. —Preceding unsigned comment added by Thefrettinghand (talk • contribs) 14:18, 24 February 2010 (UTC)

Explaining how to use in other languages
It might be worthwhile to pick one example and show how to implement it in different languages. For example, PHP users would benefit knowing it's PCRE (preg) and not POSIX (ereg). A side benefit to this might be the ability to simply list the other expressions in a table without language specific syntax although I'm unsure about that, I do like actual working examples and Perl is certainly the proper choice for that. Maybe others have thoughts on these topics. Philipolson (talk) 10:15, 15 February 2008 (UTC)

Merger into the Regular Expressions article
This article does contain some useful content and would make a great addition to the Regular expressions article. I must agree with Xosé that this article should be merged rather than being deleted. To further this proposition, I have posted the merger template on the top of the article. --Alex rosenberg35 (talk) 05:33, 27 December 2008 (UTC)
 * I agree. It has examples, it could be useful. Red Summer Rain (talk) 23:01, 16 January 2009 (UTC)


 * Another 'vote' for merging to the Regular Expressions article. Chas49 (talk) 12:29, 31 March 2009 (UTC)

Remove
I think, this article should be removed. It seems an (almost) exact copy of this article: http://en.wikibooks.org/wiki/Programming:Perl_Regular_expressions_reference

And since it is very Perl-specific syntax (a lot of the RE atoms are not recognized by grep, for instance), it should not be just merged into the general "Regular expressions" article.

Gabriel (talk) 16:24, 17 December 2009 (UTC)


 * Agreed. These examples base on the POSIX Extended Regular Expressions standard supporting ?, +, and | while still often only the POSIX Basic Regular Expressions standard is implemented.
 * Also this content of this Wikipedia article or something very similar is already an article at Wikibooks Regular Expressions/Examples. So anyone has an obligation to let Regular expression examples in the See also section of Regular expression point to that Wikibooks article and delete the Regular expression examples Wikipedia article here? --Pypes (talk) 14:48, 15 October 2010 (UTC)

i think there might be other options for introducing the public
to the concept of regular expressions, than using 'hello world' from a C program.

example.. perhaps Shakespeare or poetry or a famous speech.

just an idea. Decora (talk) 21:11, 19 November 2010 (UTC) 21:08, 19 November 2010 (UTC)