473,387 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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).
Jul 19 '05 #1
5 1256
What kind of database?

What datatype is the column?

Ray at work

"Lord Merlin" <SP*************@Bonzai.org.za_SPAM> wrote in message
news:ca**********@ctb-nnrp2.saix.net...
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).

Jul 19 '05 #2
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:Od**************@TK2MSFTNGP10.phx.gbl...
What kind of database?

What datatype is the column?

Ray at work

"Lord Merlin" <SP*************@Bonzai.org.za_SPAM> wrote in message
news:ca**********@ctb-nnrp2.saix.net...
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).



Jul 19 '05 #3
"Lord Merlin" <SP*************@Bonzai.org.za_SPAM> wrote in message
news:ca**********@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
Jul 19 '05 #4

"Lord Merlin" <SP*************@Bonzai.org.za_SPAM> wrote in message
news:ca**********@ctb-nnrp2.saix.net...
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

Jul 19 '05 #5
"Roland Hall" <nobody@nowhere> wrote in message
news:OF*************@TK2MSFTNGP12.phx.gbl...
"Lord Merlin" <SP*************@Bonzai.org.za_SPAM> wrote in message
news:ca**********@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).
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to generate unique groups (sets) of numbers - each group...
0
by: August1 | last post by:
This is a follow up to using these functions to produce lottery numbers to an outfile, then read the numbers from the file to the screen. Although other methods are certainly available. ...
0
by: newstips6706 | last post by:
1, 2, 3, 5, 7... PRIME Numbers ________________________________ Definitions What is a PRIME Number ?
7
by: newstips6706 | last post by:
1, 2, 3, 5, 7... PRIME Numbers ________________________________ Definitions What is a PRIME Number ?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.