• 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

Chris D

XenForo developer
Staff member
#2
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:

Code:
SELECT * FROM xf_post WHERE message LIKE '%[EMAIL]%'
 
Last edited:

Mr Lucky

Well-known member
#5
It won't edit the database, it's just a SELECT query.
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.

Code:
#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
 

Chris D

XenForo developer
Staff member
#6
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:

https://xenforo.com/community/resources/post-content-find-replace.1549/

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)
Code:
\[EMAIL](\S+@\S+)\[\/EMAIL]/i
Replace with:
Code:
[email]example@example.com[/email]
(or whatever you like).