It is often necessary to replace the & character with the entity & to get validated (x)html. This clip will replace all appropriate ampersands excluding those that are part of defined character entities.
This one has a really really long line at the start, so what it may do with the pre tag to your browser is anyone’s guess.
; a clip to run a file looking for ; stray & characters that aren't part ; of & etc type of special ; characters and replace them with & ; by Don Passenger ; email: don at htmlfixit.com ; comments welcome ^!SetWordWrap Off ^!Jump Doc_Start ^!ClearVariables ; assign special characters to array ^!SetListDelimiter ";" ; super long line to follow ^!SetArray %allspecialchars%="&©>< " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ—™™áâ´æàåãä¦ç¸¢¤°÷éêèðë½¼¾íî¡ì¿ï«¯µ·¬ñóôòªºøÕõö¶±£»®§­¹²³ßþ×úûù¨üý¥ÿ" ; end of super long line :Loop ; find next & ^!Find "&" TIS :Process8 ; select 8 characters starting with an & ^!Jump Select_Start ^!Select +8 ^!Set %word%=^$GetSelection$ ;^!Info x^%word%x ; split the 8 characters selected on ; ; if there is no semi-colon, then we do ; not have a special character ; if we do, then we may ^!SetListDelimiter ";" ^!SetArray %specialchar%=^%word% ; if ^%specialchar0% is 1 then we had no ; so ; goto replacement phase ^!If "^%specialchar0%" = "1" Replace& ; we have a ; so we want to test the first part up to ; the ; to see if it is a known entity ^!Set %counter%=1 :TestSpecials ; if all specials exhausted, then need to replace ^!If "^%counter%" > "^%allspecialchars0%" Replace& ; test each special character and on match go to next ^!If "^$StrLower(^%specialchar1%)$" = "^%allspecialchars^%counter%%" MatchSpecial ; that one didn't match, try again ^!Inc %counter% ^!GoTo TestSpecials :Replace& ; we found a loose & so we need to replace it ; with & ^!Jump Select_Start ^!Replace "&" >> "&" TIHS ; having replaced it go look for next ^!GoTo Loop :MatchSpecial ^!Jump Select_Start ^!MoveCursor +1 ^!GoTo Loop
Keywords: replace, ampersand, &, &, replace, valid, html, xhtml, url
September 25th, 2005 at 10:19 am
,is quote, and comma’ ok? ‘ ,
September 26th, 2019 at 5:17 am
Great post and right to the point.
Keep on sharing wonderful ideas.
Best Painters Saskatoon
October 17th, 2019 at 4:23 am
Very interesting and well done.
Interior Designs Saskatoon Sk
September 25th, 2020 at 12:40 am
Keep sharing your great works. Always fascinated with this kind of content. I enjoy reading all your articles.
Dentists
March 23rd, 2021 at 3:09 am
This is a very interesting bubble shooter game with fabulous graphics,themes and the background scenarios!
The player enjoys this interacting bubble shooter game because of the
active role of the cute Pet Raccoon.
Help to Pet Raccoon Mama to save all of her cubs.
Combine 3 or more objects the same color for destroy a bubbles.
https://goo.gl/WMCXgi
April 11th, 2021 at 3:03 am
Hmm it looks like your site ate my first comment (it
was super long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
I too am an aspiring blog blogger but I’m
still new to everything. Do you have any tips and hints for
rookie blog writers? I’d certainly appreciate it.