removing-whitespace

PHP removing more than one white-space

So, If I have a string like "hello what is my name" How can I take all of the spaces and replace each with only one space? Thanks! ...

git - trim whitespace

I've accidentally put some whitespace in my initial commit - it shows up red in git diff --color. What's the best way to get rid of the existing whitespace and how can I avoid this happening again? I am not necessarily looking for a built-in git command. Any external program available for free on Ubuntu would also be welcome. ...

rails trim whitespace from searchlogic text field

This works: Baseline Controller @search = Baseline.search(params[:search]) @baselines = @search.paginate :page => params[:page], :per_page => params[:per_page] baseline index view <% form_for @search do |f| %> <%= f.text_field :baseline_name_like_or_description_like %> <%= submit_tag 'Search' %> <% end %> Where would I trim t...

emacs delete-trailing-whitespace except current line

I recently added Emacs (delete-trailing-whitespace) function to my 'before-save-hook for some programming modes, but I find it rather frustrating that it deletes whitespace from the line I am currently editing. Any suggestions as to how to fix this problem? ...

PrettyPrinting. Ignoring whitespaces.

Hi 1st Question, be gentle. I'm trying to use javax.xml.transform.Transformer to format some xml string to be indented / spaceless between the tags. If there are no spaces between the tags, it works ok. If there are it acts weird. I'll post an example. I tried to follow up on the following topic : http://forums.sun.com/thread.jspa?mess...

Regex to match tag contents while simultaneously omitting leading and trailing whitespace

I am trying to write a regex that matches entire contents of a tag, minus any leading or trailing whitespace. Here is a boiled-down example of the input: <tag> text </tag> I want only the following to be matched (note how the whitespace before and after the match has been trimmed): "text" I am currently trying to use...