Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Regular Expressions..

Reply
Thread Tools

Regular Expressions..

 
 
Graham Mattingley
Guest
Posts: n/a
 
      11-28-2003
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



 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      11-28-2003
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)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using regular phone as voip device with regular modem? hygum VOIP 5 03-23-2005 03:51 PM
Connect 2 routers (wireless and regular routers) Dineyar Buhariwala Wireless Networking 1 11-24-2004 01:37 PM
can a strongly named assembly reference a regular assembly? Prasanna Padmanabhan ASP .Net 1 11-19-2003 06:21 AM
Custom Regular Expressions in ASP.net Jay Douglas ASP .Net 3 11-03-2003 08:09 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57