Reply
Access text fields and regular expressions
Old 10-01-2007, 01:49 PM Access text fields and regular expressions
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
I've got a rather strange question. I'm trying to build a variant of an anti-spam database, and what I'd like to do with it is to store regular expressions (e.g. V?agra for Viagra) and be able to query the database via the regular expression.

e.g. "Select Count (Pattern_ID) as Match_Count from Spam_Patterns where Pattern Like '%Viagra%'" would generate the V?agra as a match.

Is there any way to do it this way, or do I have to do it the other way around (i.e. use regular expressions in my query?)

Thanks.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
When You Register, These Ads Go Away!
Old 10-01-2007, 05:12 PM Re: Access text fields and regular expressions
Learning Newbie's Avatar
Moderator

Posts: 5,199
Name: John Alexander
Select Count(*) Where Pattern Like @Pattern

@Pattern = 'V_iagra'

Sorry, parameters in Access are [just an unknown field name].

MSDN says:
Quote:
There are a number of wildcard characters to choose from, and the following table details what they are and what they can be used for.
Wildcard character Description * or % Zero or more characters ? or _ (underscore) Any single character # Any single digit (0-9) [charlist] Any single character in charlist [!charlist] Any single character not in charlist
Note The % and _ (underscore) wildcard characters should be used only through the Jet OLE DB provider and ActiveX® Data Objects (ADO) code. They will be treated as literal characters if they are used though the Access SQL View user interface or Data Access Objects (DAO) code.
I don't think Access supports regular expressions, but has a baby version built in.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-01-2007, 05:14 PM Re: Access text fields and regular expressions
Learning Newbie's Avatar
Moderator

Posts: 5,199
Name: John Alexander
Dag, that was supposed to be a table.

* or % = Zero or more characters
? or _ (underscore) = Any single character
# = Any single digit (0-9)
[charlist] = Any single character in charlist
[!charlist] = Any single character not in charlist
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-01-2007, 06:01 PM Re: Access text fields and regular expressions
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Thanks, dude. I'll have a poke at that later on if the tack I'm on now doesn't play out.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Access text fields and regular expressions
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13207 seconds with 12 queries