Regular Expressions..

Discussion in 'ASP General' started by Graham Mattingley, Nov 28, 2003.

  1. 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
    Graham Mattingley, Nov 28, 2003
    #1
    1. Advertising

  2. Graham Mattingley

    Evertjan. Guest

    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)
    Evertjan., Nov 28, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay Douglas

    Custom Regular Expressions in ASP.net

    Jay Douglas, Nov 2, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    605
    mikeb
    Nov 3, 2003
  2. mark

    Regular expressions

    mark, Jun 30, 2003, in forum: Perl
    Replies:
    4
    Views:
    1,718
  3. Dustin D.
    Replies:
    1
    Views:
    11,180
  4. Jay Douglas
    Replies:
    0
    Views:
    598
    Jay Douglas
    Aug 15, 2003
  5. Noman Shapiro
    Replies:
    0
    Views:
    232
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page