|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 . |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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" ) ); Code:
alert( "aaa\nbbb\nccc".replace( /(.|\n)/g, "z" ) ); 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. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > Article Discussion: The Complete Regular Expression Guide |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|