Title: [Plugin: HookPress] Regex the post content?
Last modified: August 19, 2016

---

# [Plugin: HookPress] Regex the post content?

 *  [therocks](https://wordpress.org/support/users/therocks/)
 * (@therocks)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/plugin-hookpress-regex-the-post-content/)
 * First off, what an amazing plugin. WordPress and it’s community of developers
   never fail to amaze me with the things it can do.
 * I’m trying to run some Regex on my post’s content. The goal is to strip out all
   of the plain text, and only show any hyperlinks contained within the post. So
   I was looking for an answer on two things:
 * Number one, when you a run a webhook on postcontent, your webhook “sees” that
   postcontent as raw HTML, correct?
 * And secondly, here’s the code for my webhook, currently it blanks out everything
   in the post. I’m looking to see if I’m even remotely close to having the correct
   code. I have confirmed that the Regex works, as an expression, it’s a matter 
   of getting it to work in the webhook’s PHP!
 *     ```
       <?php
       $text_to_strip = 'content';
       $pattern = '/\S+:\/\/\S+/';
       preg_match_all($pattern,$text_to_strip,$matches);
       $stripped_text = implode("\n", $matches[0]);
       print($stripped_text);
       ?>
       ```
   
 * Here is the actual regular expression:
    Search pattern: `(.|\s)*?(\S+:\/\/\S+)`
   Replace with: `\2\n`
 * Thank you!

The topic ‘[Plugin: HookPress] Regex the post content?’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [therocks](https://wordpress.org/support/users/therocks/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/plugin-hookpress-regex-the-post-content/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
