Regex to find ampersands without spaces on both sides

user1234

New Member
I'm just trying to figure out the regex to find any ampersands that aren't immediately preceded and followed by a space. For example, it would find "asdf&asdf" and "asdf& asdf" but not "asdf & asdf"This will be used in a preg_replace to add spaces before and after. (If you're wondering, the problem is that I'm stuck with a WYSIWYG that has a bug where it strips spaces on both sides of ampersands, and I need to manually add them back after the fact). Thoughts?
 
Back
Top