Search strings with imbedd special characters

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

Search strings with imbedd special characters

Postby gn194586 » Thu Aug 23, 2007 11:45 am

Hello,
I guess I'm "regular expression - challenged" like many others in this forum.
I'm trying to understand how to search on an expression that contains imbedded
special characters and can't seem to get it. Any help (especially examples)
would be greatly appreciated. Following are the attempts I made and the results-

Searching for (xx1)
search string result
------------- ------
(xx1) - finds (xx1), but also (xx24), (xx60), etc.
"(xx1)" - gives - No results found for query "\\\"(xx1)\\\""
\(xx1\) - finds (xx1), but also (xx24), (xx60), etc.
\Q(xx1)E\ - finds (xx1), but also (xx24), (xx60), etc.

Searching for St. John
search string result
------------- ------
St. John - finds St. John, but also every other John
"St. John" - gives No results found for query "\\\"St. John\\\""
St\.\ John - finds everything with a blank in it? (many hits without ST. or John)
\QSt. JohnE\ - finds everything with a blank in it? (many hits without ST. or John)
gn194586
n00b
n00b
 
Posts: 1
Joined: Thu Aug 23, 2007 10:45 am

Registered Newsbin User since: 08/19/07

Postby Quade » Thu Aug 23, 2007 1:13 pm

If I was searching for "St. John".

I'd enter it as "St[.] John" (without the quotes) or "St\. John"

There's no reason to escape the space.

"\(xx1\) - finds (xx1), but also (xx24), (xx60), etc."

Should work.

If you PM me a specific group and subject, I can try it. Don't post it out here in the open.
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

Postby bobkoure » Thu Jul 10, 2008 10:25 am

Or maybe
St[.]?[ ]?John
Which would match "St.John", "St. John", "StJohn", and "St John"

The space doesn't need to be in brackets (or escaped) but, if I'm writing a filter, I put spaces in brackets just so I can see 'em if I look at it later (bad memory and not-so-great eyesight so I need all the help I can get...)
bobkoure
 

Postby Quade » Thu Jul 10, 2008 12:39 pm

What I said in my post won't be true in the future. You will have to escape the space because any spaces will imply AND and not exact pattern match.
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

Postby bobkoure » Sat Jul 12, 2008 4:19 pm

Interesting.
Still OK inside brackets: (i.e. "foo[ ]bar")?
What about if the rest of the expression indicates that it's a regex: (i.e. "^.*foo bar")?
bobkoure
 

Postby Quade » Sat Jul 12, 2008 5:52 pm

The items will still be RE compatible but, logical operators between items will also be permitted. This is needed for the new high speed local search.
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