Regular Expressions..

G

Graham Mattingley

Hi,

I have an issue where by when I use XMLHTTP to get data from another web
site, all of the '£' symbols become '?'. I have try for hours to stop this
happening but have been unsuccessful so far.

The numbers I have for example should be £9.57 and become ?9.57. I am by no
means an ASP expert and I have found some of the suggestion a bit difficult
to understand, somebody suggested "ADODB.Stream" but I could not make this
work..

I cant use REPLACE as the '?' in the string has a value of 63 but when I try
and REPLACE on ? or chr(63) it does not work.

I would like to know if it is possible to use Regular Expressions and will
this match a '?' in a string when REPLACE does not seem to see it.
All I would need to do is to

Match either a 3, 2 or 1 digit number for example ?9.56 or ?19.56 or ?119.56
with a two digit number after the '.' and replace it with £9.56 or £19.56 or
£119.56

I have found this regular expression on the web
[-+]?[0-9]*\.?[0-9]*.

I think this will match the numbers I want to

my question is how can I match a number pattern, but replace the chr before
the match i.e. the ?, I thought reg expression might work as I can basically
say match "x19.56" and replace with £19.56

hope I have not waffled to much but this is doing my head in :)

any help will be greatly appreciated

Graham
 
E

Evertjan.

Graham Mattingley wrote on 28 nov 2003 in
microsoft.public.inetserver.asp.general:
Hi,

I have an issue where by when I use XMLHTTP to get data from another
web site, all of the '£' symbols become '?'. I have try for hours to
stop this happening but have been unsuccessful so far.

The numbers I have for example should be £9.57 and become ?9.57. I am
by no means an ASP expert and I have found some of the suggestion a
bit difficult to understand, somebody suggested "ADODB.Stream" but I
could not make this work..

I cant use REPLACE as the '?' in the string has a value of 63 but when
I try and REPLACE on ? or chr(63) it does not work.

I would like to know if it is possible to use Regular Expressions and
will this match a '?' in a string when REPLACE does not seem to see
it. All I would need to do is to

Match either a 3, 2 or 1 digit number for example ?9.56 or ?19.56 or
?119.56 with a two digit number after the '.' and replace it with
£9.56 or £19.56 or £119.56

I have found this regular expression on the web
[-+]?[0-9]*\.?[0-9]*.

I think this will match the numbers I want to

my question is how can I match a number pattern, but replace the chr
before the match i.e. the ?, I thought reg expression might work as I
can basically say match "x19.56" and replace with £19.56

I would think that probably the outputted ? stands for a character value
that is not available in your font. Perhaps you can show us a URL to your
output link?

Your replace solution is a second best, since I presume that the euro sign
will also default to your ? in your case.

Under Jscript I would try:

t = "% 23.23"
t = t.replace(/.(\s*[-+]?\d+\.\d{2})/,"£$1")
response.write(t)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top