dbTalk Databases Forums  

reg expression syntax error

comp.databases.mysql comp.databases.mysql


Discuss reg expression syntax error in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jr
 
Posts: n/a

Default reg expression syntax error - 09-16-2010 , 06:33 PM






In the ndc column there were some imported rows from Excel with
scientific notation.
I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory
thankx,

Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: reg expression syntax error - 09-16-2010 , 07:26 PM






On 9/16/2010 7:33 PM, jr wrote:
Quote:
In the ndc column there were some imported rows from Excel with
scientific notation.
I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory
thankx,
Which is just ONE of the reasons you don't want to use a char field to
store numeric data.

I told you it would have unwelcome consequences. But, as usual, you
just make changes willy-nilly without understanding the consequences.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #3  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 02:25 AM



El 17/09/2010 1:33, jr escribió/wrote:
Quote:
In the ndc column there were some imported rows from Excel with
scientific notation.
I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory
Do you mean that using PHP functions in SQL code triggers syntax errors?
Weird!

http://dev.mysql.com/doc/refman/5.1/...functions.html


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Reply With Quote
  #4  
Old   
Erick T. Barkhuis
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 02:34 AM



jr:

Quote:
... but I get a syntax error.

select preg_match(^[0-9]{11}$,ndc) from inventory
That should read:

<?mysql select ?>
<?php preg_match(^[0-9]{11}$,ndc) ?>
<?mysql from inventory ?>

Might work. Perhaps.

Reply With Quote
  #5  
Old   
Captain Paralytic
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 04:39 AM



On 17 Sep, 08:25, "Álvaro G. Vicario"
<alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> wrote:
Quote:
El 17/09/2010 1:33, jr escribió/wrote:

In the ndc column there were some imported rows from Excel with
scientific notation.
* I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory

Do you mean that using PHP functions in SQL code triggers syntax errors?
Weird!
This is Janis Rough, after all this time she still doesn't know the
difference between php, mysql and javascript.

Reply With Quote
  #6  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 05:20 AM



El 17/09/2010 11:39, Captain Paralytic escribió/wrote:
Quote:
On 17 Sep, 08:25, "Álvaro G. Vicario"
alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> wrote:
El 17/09/2010 1:33, jr escribió/wrote:

In the ndc column there were some imported rows from Excel with
scientific notation.
I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory

Do you mean that using PHP functions in SQL code triggers syntax errors?
Weird!

This is Janis Rough, after all this time she still doesn't know the
difference between php, mysql and javascript.
.... or between strings and literals.

I don't know why I even try.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Reply With Quote
  #7  
Old   
Captain Paralytic
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 09:14 AM



On 17 Sep, 11:20, "Álvaro G. Vicario"
<alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> wrote:
Quote:
El 17/09/2010 11:39, Captain Paralytic escribió/wrote:





On 17 Sep, 08:25, "Álvaro G. Vicario"
alvaro.NOSPAMTH... (AT) demogracia (DOT) com.invalid> *wrote:
El 17/09/2010 1:33, jr escribió/wrote:

In the ndc column there were some imported rows from Excel with
scientific notation.
* *I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory

Do you mean that using PHP functions in SQL code triggers syntax errors?
Weird!

This is Janis Rough, after all this time she still doesn't know the
difference between php, mysql and javascript.

... or between strings and literals.

I don't know why I even try.
I think it's cruel that anyone tries. All it means is that someone
somewhere is paying her to really screw up their system and she is
managing to give the idea that she can do something by using stuff
written for her by others, but embedding it in whatever mess she
manages by luck to write for herself.

I tried responding to her posts a long time ago until I realised that
she simply did not have the intelligence to understand even the basics
of programming.

Reply With Quote
  #8  
Old   
jr
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 11:32 AM



On Sep 16, 5:26*pm, Jerry Stuckle <jstuck... (AT) attglobal (DOT) net> wrote:
Quote:
On 9/16/2010 7:33 PM, jr wrote:

In the ndc column there were some imported rows from Excel with
scientific notation.
* I am trying to find those rows using preg_match so I can located
the . and then pad with zeros the number of the exponent but I get a
syntax error.The correct field has 11 digits and has leading zeros.
It is a char field.

select preg_match(^[0-9]{11}$,ndc) from inventory
select preg_match(^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
[0-9]$,ndc) from inventory
thankx,

Which is just ONE of the reasons you don't want to use a char field to
store numeric data.

I told you it would have unwelcome consequences. *But, as usual, you
just make changes willy-nilly without understanding the consequences.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck... (AT) attglobal (DOT) net
==================
it has to be padded with zeros. I have to upload it from Excel and
when I made it a number it lost the left zeros. I tried zerofill and
it added 11 zeros to NULL values. Some of the excel sheets have
scientific notation in error. The user had that in the sheets by
accident and they got uploaded that way. I am trying to fix it. i
can run the script in PHP thats fine. Thank you ALL for your helpful
comments.

Reply With Quote
  #9  
Old   
jr
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 11:37 AM



On Sep 17, 12:34*am, "Erick T. Barkhuis" <erick.use-... (AT) ardane (DOT) c.o.m>
wrote:
Quote:
jr:

... but I get a syntax error.
select preg_match(^[0-9]{11}$,ndc) from inventory

That should read:

?mysql select ?
?php preg_match(^[0-9]{11}$,ndc) ?
?mysql from inventory ?

Might work. Perhaps.
thanks,

Reply With Quote
  #10  
Old   
Erick T. Barkhuis
 
Posts: n/a

Default Re: reg expression syntax error - 09-17-2010 , 12:08 PM



jr:

Quote:
On Sep 17, 12:34*am, "Erick T. Barkhuis" <erick.use-... (AT) ardane (DOT) c.o.m
wrote:
jr:

... but I get a syntax error.
select preg_match(^[0-9]{11}$,ndc) from inventory

That should read:

?mysql select ?
?php preg_match(^[0-9]{11}$,ndc) ?
?mysql from inventory ?

Might work. Perhaps.

thanks,
Oh dear!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.