Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 27th, 2002, 08:44 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Article Discussion: The Complete Regular Expression Guide

The Complete Regular Expression Guide If you have any questions or comments about this article then please post them here.

You can read the article here .

Reply With Quote
  #2  
Old December 29th, 2002, 08:03 AM
Albie Albie is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Northwest Blackpool, England
Posts: 1 Albie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Albie Send a message via Yahoo to Albie
Re: Article Discussion: The Complete Regular Expression Guide

I put brain into gear and realised this post was a load of crap

<3 Dev Articles

Last edited by Albie : December 29th, 2002 at 08:07 AM.

Reply With Quote
  #3  
Old January 6th, 2003, 04:22 PM
beetle18 beetle18 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Victoria, TX
Posts: 29 beetle18 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to beetle18 Send a message via AIM to beetle18
I think it's important to note that the . or full stop meta character will NOT match a newline character (\r\n|\r|\n) in javascript.

So, the statement made by the author that it matches ANY character is false. This is easily seen in this example
Code:
alert( "aaa\nbbb\nccc".replace( /./g, "z" ) );
To fix this, we'd need this
Code:
alert( "aaa\nbbb\nccc".replace( /(.|\n)/g, "z" ) );
Since you really don't want to put the full stop into a character class, we just use am alternative group instead.

Otherwise, a fantastic article on regex

Also, Albie. *\.[ch]pp DOES match only cpp or hpp. Remember, those brackets create a character class inside which ANY charater listed is valid. In this case, a c or an h, which makes this identical to your *\.(c|h)pp

However, I would prefer to use *\.[ch]pp because (1) It does not create a remembered match and thus consume a backreference and (2) to make it NOT a remebered match consuming a backreference requires *\.(?:c|h)pp which is three more characters than *\.[ch]pp and let's face it, we all want to keep our regexs as short as possible

Last edited by beetle18 : January 6th, 2003 at 04:35 PM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: The Complete Regular Expression Guide


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT