If you happen to ignore the secrets of regular expressions and you need to perform these rather common tasks, here is how you can do it.
A most useful search (and replace or remove) command is when you need to get rid of some links.
/<a href="http:\/\/domain\.com[^>]*>([\s\S]*?)<\/a>/
The formula above will find any domain.com link. If you need to remove the link and keep its reference unlinked, just use in the “replace” box the instruction $1
* Search for image tags
/<img([\s\S]*?)>/
* Search for images in a link to select both the image and the link
/<a href=[^>]*><img src="([\s\S]*?)><\/a>/
* Search for images with captions
/\[caption([\s\S]*?)\/caption]/
Related Posts:
- Search your files, even with regex and previews of results, using Agent Ransack
- RegEx: Regular Expressions you must know for search and replace
- Replace TAGS and SHORTCODES with Search RegEx WP plugin
- Search Regex WordPress plugin Uncaught Error: Call to undefined method base_url
- You can create very interesting fractals after 50 formulas, with Sterling2
- Adjust the precision of computations, even save formulas as macros, with Precise Scientific Calculator
- Edit scientific studies facilitating formulas etc., with LyX editor
- Find, fix, monitor broken links, even batch edit, with WP Broken Link Checker
- Remove fake virus attacks from your PC with Remove Fake Antivirus
- Find and delete empty folders with RED - Remove Empty Directories
- Find and remove duplicates in Winamp playlists
- Mass copy, remove and search files and folders, with XXCOPY