1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Search for posts with email addresses

Discussion in 'Enhanced Search Support' started by Mr Lucky, May 20, 2016.

  1. Mr Lucky

    Mr Lucky Well-Known Member

    Is there a way to search for just for posts that have email addresses in them?

  2. Chris D

    Chris D XenForo Developer Staff Member

    Most will have been converted to [EMAIL] tags, especially if they were posted in XF. Likely too if your forum software prior to XF if there was one supported a similar thing.

    With that in mind, searching for [EMAIL] should work.

    EDIT: After a test here, this may not work. You may be better off searching for it via the database:

    SELECT * FROM xf_post WHERE message LIKE '%[EMAIL]%'
    Last edited: May 20, 2016
  3. Mr Lucky

    Mr Lucky Well-Known Member

    That's right, searching it also picks up the word [I]email
    Thanks, I don't want to edit database but I think you are right, that could be the only solution.
  4. Chris D

    Chris D XenForo Developer Staff Member

    It won't edit the database, it's just a SELECT query.
  5. Mr Lucky

    Mr Lucky Well-Known Member

    Yes, but my aim here is to take out any email addresses, so I either need to do it (ideally) via edit on the forum, or (after searching the database) manually on the database (which I'd prefer not to do)

    So if I do a search on the database, I think that will be a complicate way to get to the post so I can edit them on the forum.

    However at the moment it's a bit moot as that query gives me an error.

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%[EMAIL]% LIMIT 0, 30' at line 1
  6. Chris D

    Chris D XenForo Developer Staff Member

    I've fixed the query above.

    I'd only had one coffee by that time...

    If the aim is to replace the email addresses, you'd probably be best with the Post Content Find and Replace Tool:


    If you post in the resource thread, someone will likely point you in the direction of the correct regex to use.

    Probably something like this, though. (Haven't tested it)
    Replace with:
    (or whatever you like).
  7. Mr Lucky

    Mr Lucky Well-Known Member

    Good idea thanks

    yes I want to replace with something like person -at- emailaddress.com

Share This Page