This is as more about the learning process than the actual task... but I can't see what's wrong with my regex, and I'd appreciate any pointers.<br><br>I want to find cases where a header is not followed by a line break, e.g. <br>
<br><div style="margin-left: 40px;">"== External links ==;<a href="http://www.americanbamboo.org/GeneralInfo.html">http://www.americanbamboo.org/GeneralInfo.html</a><br></div><br>I tried various regex strings, including "([\r\n]==[^\n=]*==)([^=\r ])" (allowing for the fact that excess spaces on the end aren't important) to be replaced by "\\1\n\\2"<br>
<br>But I get many false matches. See <a href="http://www.pastie.org/913753">http://www.pastie.org/913753</a> for details of the good and the false matches.<br><br><br>In #regex on freenode I was told to try: "<span>s/((={2,}).*?\2)(?!\n)([^=]?)/\1\n\2/g" but it gives the error:</span><span> "bash: !\n: event not found"</span>.<br>
<br>I'm told that it works - <a href="http://pastie.org/913765">http://pastie.org/913765</a> - but in my terminal I can't get past the bash error.<br><br><br>Thanks!<br><br>-- <br>Chris Watkins<br><br>Appropedia.org - Sharing knowledge to build rich, sustainable lives.<br>
<br><a href="http://blogs.appropedia.org">blogs.appropedia.org</a><br><a href="http://community.livejournal.com/appropedia">community.livejournal.com/appropedia</a><br><a href="http://identi.ca/appropedia">identi.ca/appropedia</a><br>
<a href="http://twitter.com/appropedia">twitter.com/appropedia</a><br>