Link to home
Create AccountLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Remove   Using Dreamweaver CC

I have an editor that is putting in many  's in the source code it is creating.  I have been unable to stop the insertion of the strings but I do need them removed.

Here is an example
<tr><td align="left" style="color: #6e6f74; font-family: Arial, Helvetica, sans-serif; font-size: 14px; padding: 0px 0px 0px 10px; text-align: left;"><a href="" style="color: #5583c7;" target="_blank"><img alt="Nature's Sunshine" src="" style="border: 0px; display: block;" /></a></td><td align="right" style="color: #6e6f74; font-family: Arial, Helvetica, sans-serif; font-size: 14px; padding: 0px;" valign="middle">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <table border="0" cellpadding="0" cellspacing="0" style="border-spacing: 0px;"><tbody>

Open in new window

Please help me with a regex that will remove these extra strings.

I have tried many options using RegexBuddy but I can't seem to get it to match correctly.

Open in new window

replacing with $1 $3.

This is the output I get
<tr><td alig ="left"  tyle="color: #6e6f74  fo t-family: Arial, Helvetica,  an -serif  fo t- ize: 14 x;  addi g: 0 x 0 x 0 x 10 x; text-alig : left "><a href="htt ://www.theher ale"  tyle="color: #5583c7 " target="_ la k"><img alt="Nature'  Su hi e"  rc="htt ://image.exct. et/li /ff2c1c757166/i/4/096 f034-0.j g"  tyle=" order: 0 x; di lay:  lock " /></a></td><td alig ="right"  tyle="color: #6e6f74  fo t-family: Arial, Helvetica,  an -serif  fo t- ize: 14 x;  addi g: 0 x;" valig ="middle">
&  <ta le  order="0" cell addi g="0" cell aci g="0"  tyle=" order- aci g: 0 x;"><t ody>

Open in new window

It seems to be ignoring I need the whole string removed but is in turn removing the single characters too.

Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

try create your website as a project in your DW, and then do a Find and Replace for the entire site.... (find &nbsp and replace it with blank)

Find and replace text, tags, and attributes
Avatar of sharingsunshine


Thanks for getting back to me.  The only problem is that these encoded spaces don't show on Dreamweaver but they do when I transfer them to Blogger.  So I need to remove the white space that translates to &nbsp; outside of dreamweaver.

Here is a screenshot of what it looks like before I paste it into blogger.
why bother about the "white space" in HTML? it will not affect how HTML is being generated
I know that but when I take the source code and post it to blogger I get all of the extra &nbsp;'s that skew the way the content is presented.  If I can get a regex to remove it then the  content won't be skewed on blogger.
what about if you paste the content into a Notepad before copy it again from Notepad to blogger, will the blogger still adding the white spaces?

for the blogger, can you paste the content in HTML view?
I appreciate all of the suggestions but as I asked in the beginning.  I really want a regex to do the job.  Not only for this problem but for some others not specified.
If you want to keep the first you can use this and delete all matches
(?<=&nbsp\;)(&nbsp\;| |\n|\r)+

Open in new window

Here is demo
User generated image
I am getting this message 

I have tried this in Dreamweaver CC and Brackets both.
Perhaps Dreamweaver does not support all RegEx syntaxes
You are probably correct but I need it to work on Dreamweaver.  So can you build one using its capabilities?
try without positive look behind:

Open in new window

\s matches any whitespace character (equal to [\r\n\t\f\v ])
That would remove all &nbsp;, not true?
It would remove all &nbsp;'s AND whitespace if and only if preceded by &nbsp;

I created an even better RegEx for Dreamweaver CC (tested in 2018 version):


Open in new window

It removes whitespace which proceeds and succeeds (if any) &nbsp;'s and the &nbsp;'s
I assume OP wants to keep one so just replace with &nbsp;?
Avatar of NerdsOfTech
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
extra &nbsp;
In this case, greedy \s matches are better, final draft of RegEx for DW CC:


Open in new window

User generated image
and @Shaun please re-read the OP comment; OP is saying both whitespace (and extra &nbsp;'s, as a result of blogger's encoding) are an issue and that they should be eliminated.
Please reread my comments especially #a42418762, I know about the white-space and line-breaks.

My question is... Why is it okay to remove all whitespace (&nbsp; etc.)  when it repeats but leave it when there is one?
Either one needs to stay when there is a repeat -OR- all needs to be removed irrespective of repeats
Why is it okay to remove all whitespace (&nbsp; etc.)  when it repeats but leave it when there is one?


If I have one whitespace it is because I put it there.  If I need repeats I use CSS.