faqts : Computers : Programming : Languages : PHP : Common Problems : Regular Expressions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 11 people (45%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

Do I need to escape characters inside a [] set in a regular expression?

Jul 9th, 2003 13:09
Gerhardt, Nathan Wallace, Adam Trachtenberg


You don't need to escape "(", ")", "?", "." and "-" inside of [], 
since it's
clear they represent literal "." and "-", not regex metacharacters.