HtmlPurifier: Remove Ambiguous WhiteSpace?

Is it possible to remove ambiguous whitespace from a string containing html with HTMLPurifier? I wasn't able to find anything relevant in the documentation. I'm also open to other methods if they exist.

Example Input:

Test Line1 <p> Test Line2</p> <p> Line 3</p>

Optimal Output:

Test Line1<p>Test Line2</p><p>Line 3</p>

Thanks!!!!!!

--------------Solutions-------------

Can regular expression help?

$text = preg_replace('/\s+/u', '', $text)

Category:formatting Time:2011-02-05 Views:2

Related post

  • How to automatically remove trailing whitespace in Visual Studio 2008? 2008-09-17

    Is it possible to configure Visual Studio 2008 to automatically remove whitespace characters at the end of each line when saving a file? There doesn't seem to be a built-in option, so are there any extensions available to do this? --------------Solut

  • How to remove trailing whitespace of all files recursively? 2008-09-29

    How can you remove all of the trailing whitespace of an entire project? Starting at a root directory, and removing the trailing whitespace from all files in all folders. Also, I want to to be able to modify the file directly, and not just print every

  • How to auto-remove trailing whitespace in Eclipse? 2009-06-25

    The question has two parts, one of which I already have the answer for. How to auto-remove trailing whitespace from the entire file being edited? -> Answer: use the AnyEdit plugin, which can be set to do that on any save to the file. How to auto-r

  • Easiest way to remove all whitespace from a code file? 2009-11-19

    So I'm participating in one of the Code Golf competitions where the smaller your file size is, the better. Rather than manually removing all whitespace etc, I'm looking for a program or website which will take a file, remove all whitespace (including

  • Remove multiple whitespaces 2010-02-24

    I'm getting $row['message'] from a MySQL database and I need to remove all whitespace like \n \t and so on. $row['message'] = "This is a Text \n and so on \t Text text."; should be formatted to: $row['message'] = 'This is a Text and so on Text text.'

  • removing trailing whitespace for all files in ediff-trees session 2010-10-07

    I am using the very handy ediff-trees.el http://www.emacswiki.org/emacs/ediff-trees.el to compare two versions of a pile of Python code provided by one of my project partners. Unfortunately, these guys are checkin in code with trailing whitespace (ex

  • How can I remove all whitespaces and linebreaks in Perl? 2010-10-14

    I have a string that looks like this... " http://www.example.com/ example.pdf" I need to remove the whitespaces and linebreaks. How do I do this? My result should be "http://www.example.com/example.pdf" --------------Solutions------------- $string =~

  • Remove all whitespaces in a file- Linux 2010-11-05

    How would I remove ALL whitespaces in a given file in Linux? --------------Solutions------------- Depending on your definition of whitespace, something like: tr -d ' \t\n\r\f' <inputFile >outputFile would do the trick. sed 's/\s//g' input.txt |

  • NetBeans Removing Trailing Whitespace on Save and Tabs to Spaces 2010-11-07

    Just started to use NetBeans, but trying to work out how to: Make it so that trailing whitespace is removed on save, I know you can invoke it manually, but its annoying if you forget, can it be done automatically on save? I want this done because it

  • removing trailing whitespace with sed 2010-12-14

    I have a simple shell script that removes trailing whitespace from a file. Is there any way to make this script more compact (without creating a temporary file)? sed 's/[ \t]*$//' $1 > $1__.tmp cat $1__.tmp > $1 rm $1__.tmp --------------Soluti

  • How to Remove Excess Whitespace in String Using Regex 2011-01-31

    I have a series of paragraphs that I want to parse using regular expressions, but unfortunately, the paragraph is appearing with many white spaces in between sentences, and sometimes words. I would like to be able to remove all excess white space, bu

  • Removing leading whitespace from a string 2011-03-29

    Hi I have list of strings [" 0" " 1" " 2"] and I want to remove the whitespace from the start of one of them. How would I do this? --------------Solutions------------- If you want to remove the whitespace from all of them, you could use a = [" 0", "

  • Removing trailing whitespaces same as vim 2011-05-13

    Based on this vimcast I changed my .vimrc file. http://vimcasts.org/episodes/tidying-whitespace#highlighter_963342 Now every single time I touch a file that file has a number of changes related to trailing whitespaces. In one single sweep I want to r

  • Efficient way to remove ALL whitespace from String? 2011-06-02

    I'm calling a REST API and receiving an XML response back. It returns a list of a workspace names and I'm writing a quick IsExistingWorkspace() method. Since all workspaces consist of contiguous characters with no whitespace, I'm assuming the easiest

  • Aptana 3 - How remove trailing whitespaces on save 2011-08-27

    I'm trying Aptana3 but I don't find an essential feature : Remove trailing whitespaces/empty lines on save. --------------Solutions------------- Not possible with Aptana 3.1. See http://jira.appcelerator.org/browse/APSTUD-814 But since Aptana is (was

  • BeautifulSoup removes trailing whitespace? 2011-08-30

    Apparently using Soup.text removes trailing whitespace for some reason. For example: In [1]: from BeautifulSoup import BeautifulSoup as Soup In [2]: print Soup('<a href=''>a </a>').text+ 'a' aa Is this intended behaviour and is there any

  • Mysql remove all whitespaces from the entire column 2011-09-06

    Is there a way to remove all whitespaces from a specific column for all values? --------------Solutions------------- Can this help to you ? http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim http://dev.mysql.com/doc/refman/5.0

  • Removing empty whitespace at the end of a line of text in Aptana 3 2011-09-07

    In Aptana 2 there was this tidy thing or something like that that you could setup to remove empty whitespace from the ends of lines after saving. You could set it to preserve empty lines and so on. Can this be done in Aptana 3 because I'm not seeing

  • do not remove leading whitespaces when enclosing text in an environment using vim's latex-suite 2011-09-29

    I am using vim with latex-suite plugin. I have a piece of text, that I want to enclose in verbatim environment. Let's say it looks like this: <?xml version="1.0" encoding="UTF-8"?> <errors> <error>Record not found</error> <

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.561 (s). 13 q(s)