Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4067616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:16:19+00:00 2026-05-20T16:16:19+00:00

I have performed full text indexing on a column in my mysql database. I

  • 0

I have performed full text indexing on a column in my mysql database. I want to use the regex filtering capability. I assumed these two would be equivalent.

>>> sum([bool(re.findall(r'\w+',p.abstract)) for p in Publication.objects.all()])
8467
>>> Publication.objects.filter(abstract__regex=r"\w+").count()
7974

If I go to even more complicated regular expressions I get much more varied results. For example \W{2} returns 13 and 8039 respectively. What am I missing here? Clearly my interpretation of __regex is incorrect.

EDIT:

http://dev.mysql.com/doc/refman/5.1/en/regexp.html

To expand on Gareth’s answer. Mysql has it’s own set of escaping rules. For example [[:alpha:]] is mysql speak for \w

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:16:20+00:00Added an answer on May 20, 2026 at 4:16 pm

    The Django __regex filter uses the regex facility of the underlying database, which in your case is MySQL. It would appear that MySQL’s interpretation of the regular expression you list is not the same as Python’s. (I think — but I’m basing this on a brief web search rather than anything more principled, so don’t trust it — MySQL may treat \w as simply meaning w.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you recommend a full-text search engine? (Preferably open source) I have a database
I'm using this query to perform a full text search on a MySQL database:
I have a table with a 'filename' column. I recently performed an insert into
I have written a query which will perform Full Text search using full search
I have basic stored procedure that performs a full text search against 3 columns
I have the following query, which performs a full-text search (CONTAINSTABLE) on the Products
We use Lucene.NET to implement a full text search on a clients website. The
I need to use full text search but the tables that I am using
I have an External List over a products table in our database. I want
link text I want to use the TIFF IFilter built in to Windows 2008

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.