regexing through numbers?

Discussion in 'ASP General' started by Lord Merlin, Jun 7, 2004.

  1. Lord Merlin

    Lord Merlin Guest

    Can someone please give me some quidelines with this.

    In our database I have various phone numbers, and they could start with 082
    / 083 / 084 / 072 / 073 / 074. How do I check any of these and change them
    to 2782 / 2783 / 2784 / etc etc?

    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
     
    Lord Merlin, Jun 7, 2004
    #1
    1. Advertising

  2. Lord Merlin

    Ray at Guest

    What kind of database?

    What datatype is the column?

    Ray at work

    "Lord Merlin" <_SPAM> wrote in message
    news:ca2ifb$9be$...
    > Can someone please give me some quidelines with this.
    >
    > In our database I have various phone numbers, and they could start with

    082
    > / 083 / 084 / 072 / 073 / 074. How do I check any of these and change them
    > to 2782 / 2783 / 2784 / etc etc?
    >
    > --
    >
    > Kind Regards
    > Rudi Ahlers
    > +27 (82) 926 1689
    >
    > Greater love has no one than this, that he lay down his life for his

    friends
    > (John 15:13).
    >
    >
     
    Ray at, Jun 7, 2004
    #2
    1. Advertising

  3. Lord Merlin

    Lord Merlin Guest

    Well, it's a MSSQL DB, but that doesn't really matter, cause I grab the info
    from the DB, and then work with it,in ASP code

    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
    "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    message news:...
    What kind of database?

    What datatype is the column?

    Ray at work

    "Lord Merlin" <_SPAM> wrote in message
    news:ca2ifb$9be$...
    > Can someone please give me some quidelines with this.
    >
    > In our database I have various phone numbers, and they could start with

    082
    > / 083 / 084 / 072 / 073 / 074. How do I check any of these and change them
    > to 2782 / 2783 / 2784 / etc etc?
    >
    > --
    >
    > Kind Regards
    > Rudi Ahlers
    > +27 (82) 926 1689
    >
    > Greater love has no one than this, that he lay down his life for his

    friends
    > (John 15:13).
    >
    >
     
    Lord Merlin, Jun 8, 2004
    #3
  4. Lord Merlin

    Roland Hall Guest

    "Lord Merlin" <_SPAM> wrote in message
    news:ca4oc7$bjs$...
    : Well, it's a MSSQL DB, but that doesn't really matter, cause I grab the
    info
    : from the DB, and then work with it,in ASP code

    If you're doing it in ASP and the field is text [leading zeros] then you can
    just use replace:

    newPhoneArea = replace(strPhoneArea,"0","27")

    This assumes 0 is not used anywhere else in the area code. If it is, then:

    newPhoneArea = "27" & mid(strPhoneArea,2)

    HTH...

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Jun 8, 2004
    #4
  5. Lord Merlin

    Ray at Guest

    "Lord Merlin" <_SPAM> wrote in message
    news:ca4oc7$bjs$...
    > Well, it's a MSSQL DB, but that doesn't really matter,


    Of course it matters.

    > cause I grab the info
    > from the DB, and then work with it,in ASP code


    It matters because you could most likely do this with one simple UPDATE
    instead of pulling all the data into a recordset and trying to manipulate
    it.

    > What datatype is the column?

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    Ray at work
     
    Ray at, Jun 8, 2004
    #5
  6. Lord Merlin

    Lord Merlin Guest

    "Roland Hall" <nobody@nowhere> wrote in message
    news:OF$...
    "Lord Merlin" <_SPAM> wrote in message
    news:ca4oc7$bjs$...
    : Well, it's a MSSQL DB, but that doesn't really matter, cause I grab the
    info
    : from the DB, and then work with it,in ASP code

    If you're doing it in ASP and the field is text [leading zeros] then you can
    just use replace:

    newPhoneArea = replace(strPhoneArea,"0","27")

    This assumes 0 is not used anywhere else in the area code. If it is, then:

    newPhoneArea = "27" & mid(strPhoneArea,2)

    HTH...

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp


    Hi Roland


    This is what I'm looking for, newPhoneArea = "27" & mid(strPhoneArea,2).
    Casuse there would very well be 0's anywhere in any phone number. Let me
    work with this, thanx. I need to be able to check if it number already has
    27 in front, but that I'll be able todo with this piece of code as well
    then.

    Re, Ray:
    | It matters because you could most likely do this with one simple UPDATE
    | instead of pulling all the data into a recordset and trying to manipulate
    it.

    This is not really an option, cause some users enter their phone numbers
    with the international syntax, and some not, also this only applies to ppl
    living in South africa, so I don't want todo a DB update. I think the better
    solution would be though, to check if the number has got the 27 in front,
    before saving it to the DB, if not change it, and then save to the DB, which
    is why Roland's stuff would work nicely.
    --

    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
     
    Lord Merlin, Jun 8, 2004
    #6
    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. Subra
    Replies:
    25
    Views:
    1,222
    user923005
    Mar 8, 2007
  2. Andrew Tatum

    Fibonacci Numbers and Lucas Numbers

    Andrew Tatum, May 26, 2007, in forum: C++
    Replies:
    6
    Views:
    582
    Howard
    May 27, 2007
  3. Lance Hoffmeyer
    Replies:
    2
    Views:
    537
    Lance Hoffmeyer
    Jul 26, 2007
  4. jko170
    Replies:
    9
    Views:
    132
    jko170
    Jan 21, 2009
  5. Roger Pack
    Replies:
    3
    Views:
    106
    Caleb Clausen
    Dec 2, 2009
Loading...

Share This Page