Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:41 PM
Lord Merlin
Guest
 
Posts: n/a
Default regexing through numbers?

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).


  #2  
Old July 19th, 2005, 01:41 PM
Ray at
Guest
 
Posts: n/a
Default Re: regexing through numbers?

What kind of database?

What datatype is the column?

Ray at work

"Lord Merlin" <SPAM_LordMerlin@Bonzai.org.za_SPAM> wrote in message
news:ca2ifb$9be$1@ctb-nnrp2.saix.net...[color=blue]
> Can someone please give me some quidelines with this.
>
> In our database I have various phone numbers, and they could start with[/color]
082[color=blue]
> / 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[/color]
friends[color=blue]
> (John 15:13).
>
>[/color]


  #3  
Old July 19th, 2005, 01:42 PM
Lord Merlin
Guest
 
Posts: n/a
Default Re: regexing through numbers?

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:OdFehPNTEHA.3724@TK2MSFTNGP10.phx.gbl...
What kind of database?

What datatype is the column?

Ray at work

"Lord Merlin" <SPAM_LordMerlin@Bonzai.org.za_SPAM> wrote in message
news:ca2ifb$9be$1@ctb-nnrp2.saix.net...[color=blue]
> Can someone please give me some quidelines with this.
>
> In our database I have various phone numbers, and they could start with[/color]
082[color=blue]
> / 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[/color]
friends[color=blue]
> (John 15:13).
>
>[/color]




  #4  
Old July 19th, 2005, 01:42 PM
Roland Hall
Guest
 
Posts: n/a
Default Re: regexing through numbers?

"Lord Merlin" <SPAM_LordMerlin@Bonzai.org.za_SPAM> wrote in message
news:ca4oc7$bjs$1@ctb-nnrp2.saix.net...
: 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


  #5  
Old July 19th, 2005, 01:42 PM
Ray at
Guest
 
Posts: n/a
Default Re: regexing through numbers?


"Lord Merlin" <SPAM_LordMerlin@Bonzai.org.za_SPAM> wrote in message
news:ca4oc7$bjs$1@ctb-nnrp2.saix.net...[color=blue]
> Well, it's a MSSQL DB, but that doesn't really matter,[/color]

Of course it matters.
[color=blue]
> cause I grab the info
> from the DB, and then work with it,in ASP code[/color]

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.
[color=blue]
> What datatype is the column?[/color]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Ray at work



  #6  
Old July 19th, 2005, 01:42 PM
Lord Merlin
Guest
 
Posts: n/a
Default Re: regexing through numbers?

"Roland Hall" <nobody@nowhere> wrote in message
news:OF$2TLZTEHA.904@TK2MSFTNGP12.phx.gbl...
"Lord Merlin" <SPAM_LordMerlin@Bonzai.org.za_SPAM> wrote in message
news:ca4oc7$bjs$1@ctb-nnrp2.saix.net...
: 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).


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles