Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > regexing through numbers?

Reply
Thread Tools

regexing through numbers?

 
 
Lord Merlin
Guest
Posts: n/a
 
      06-07-2004
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).


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      06-07-2004
What kind of database?

What datatype is the column?

Ray at work

"Lord Merlin" <(E-Mail Removed)_SPAM> wrote in message
news:ca2ifb$9be$(E-Mail Removed)...
> 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).
>
>



 
Reply With Quote
 
 
 
 
Lord Merlin
Guest
Posts: n/a
 
      06-08-2004
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:(E-Mail Removed)...
What kind of database?

What datatype is the column?

Ray at work

"Lord Merlin" <(E-Mail Removed)_SPAM> wrote in message
news:ca2ifb$9be$(E-Mail Removed)...
> 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).
>
>





 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      06-08-2004
"Lord Merlin" <(E-Mail Removed)_SPAM> wrote in message
news:ca4oc7$bjs$(E-Mail Removed)...
: 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


 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      06-08-2004

"Lord Merlin" <(E-Mail Removed)_SPAM> wrote in message
news:ca4oc7$bjs$(E-Mail Removed)...
> 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



 
Reply With Quote
 
Lord Merlin
Guest
Posts: n/a
 
      06-08-2004
"Roland Hall" <nobody@nowhere> wrote in message
news:OF$(E-Mail Removed)...
"Lord Merlin" <(E-Mail Removed)_SPAM> wrote in message
news:ca4oc7$bjs$(E-Mail Removed)...
: 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).


 
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
looping through json array loops through the characters instead ofthe values Aaron Javascript 2 04-10-2011 05:58 PM
regexing a file's contents without reading the whole thing? Roger Pack Ruby 3 12-02-2009 01:33 AM
Adding items to listbox through java script then accessing through asp.net Brian Henry ASP .Net 5 08-03-2004 02:10 AM
RE: Sending Through ^] Through telnetlib Mahrt, Dallas Python 0 01-23-2004 07:04 PM
Sending Through ^] Through telnetlib John Abel Python 2 01-23-2004 05:47 PM



Advertisments