' (quote) or \ (backslash) -- Which is the escape character?

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

' (quote) or \ (backslash) -- Which is the escape character?

Postby Vanguard » Mon Aug 11, 2003 2:22 pm

When writing up expressions, I used something like:

\.html

which should match on ".html" (so the period character is treated as a period instead of a special character used to mean "1 of any character at this position"). I think this is what the author told me to use.

However, according to http://www.newsbin.com/nb33help/regexp.htm, the quote character is the escape character, so my expression would be:

'.html

That just doesn't look right. Are both the quote and backslash used to denote "next character is a non-special character". Or is the backslash supposed to mean this and the quote actually does something else? Or is one deprecated and the other is the recommended mechanism?
Vanguard
n00b
n00b
 
Posts: 4
Joined: Tue Jul 01, 2003 10:15 am

Postby Smite » Mon Aug 11, 2003 2:54 pm

Well, it might have worked that way in v3.3, but I think someone just screwed up the doc. :) It's the \ character in 4.x
User avatar
Smite
Katamari Damacy Addict
 
Posts: 5318
Joined: Sat May 19, 2001 1:54 am
Location: Alberta, Canada

Registered Newsbin User since: 03/27/03

Postby Quade » Mon Aug 11, 2003 2:57 pm

I typically use [.]html. Meaning the literal character ".".
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 44981
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97


Return to Regular Expressions

Who is online

Users browsing this forum: No registered users and 2 guests