Click to See Complete Forum and Search --> : Removing GBP symbol from a string


tony_britannia
01-19-2009, 06:48 AM
I have some code to adjust data entered into a web page template to use it in a javascript function. This, amongst other things, will remove start and end spaces, replace the inter-word spaces with hyphens, etc etc.

However I am struggling to remove pound (£) signs.

Is there something different that I need to do for currency symbols?

Any help would be appreciated!

Thanks

Tony

------------------------------------------------------------

Here is the code for the other RegExs:
$idref =~ s/\'//g; # remove '
$idref =~ s/\&amp\; //g; # remove &amp;<space>
$idref =~ s/\& //g; # remove &<space>
$idref =~ s/\,//g; # remove ,
$idref =~ s/\"//g; # remove "
$idref =~ s/\-//g; # remove -
$idref =~ s/\?//g; # remove ?
$idref =~ s/ /_/g; # replace spaces with _

tony_britannia
01-19-2009, 10:49 AM
I found a response for anyone having the same issue.

The following RegEx removes all non-word characters:

=~ s/[^\w]//g;

Sixtease
01-20-2009, 02:37 AM
This
=~ s/\W//g;
does too and is one more touch simpler. :-)