Talk:Regular expression examples
From Wikipedia, the free encyclopedia
Contents |
[edit] 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.
[edit] Synchronization with wikibook article
This article should probably be synchronized with http://en.wikibooks.org/wiki/Programming:Perl_Regular_expressions_reference
[edit] 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)
[edit] 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)
[edit] 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#Uses of regular expressions 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)
- 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)
- 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 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)
[edit] 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)