Encerrado

PHP Regular Expression

Hello

I need a PHP function which uses regular expressions to strip out all non-numerical characters (except ".") from a form field variable to ensure that what is left over is a valid "price" to 2 decimal places. For example:

£123.05 becomes 123.05 (no currency symbol)

$123.007 becomes 123.01 (rounded up and, again, no currency symbol)

1,000.00 becomes 1000 (no comma - trailing .00 optional)

etc.

The function should also be robust enough to handle non-sensical values such as:

000.75

£££[url removed, login to view]

adfdf.1

123t

£$122

123..0034

etc.

and in each case return an error message.

In short, the function should be able to handle any humanly recognisable price format and return a numerical value or alert the user that a value is not valid.

## Deliverables

I basically require a PHP function/regular expression that works! PHP only please, no javascript. Source code of all work done. Complete ownership and distribution copyrights to all work purchased. Thanks ;-)

Habilidades: Engenharia, MySQL, PHP, Arquitetura de software, Teste de Software

Ver mais: what is a regular expression, uses of regular expressions, regular expressions in c, regular expressions example, regular expressions c, regular expression or example, regular expression no, regular expression in c, regular expression function, regular expression example, regular expression code, regular expression c, regular expression a, regular expression 0, example regular expressions, example of regular expression, c regular expressions, c regular expression example, php symbol, regular, php function , Expression, currency source code, currency javascript, php expression

Acerca do Empregador:
( 127 comentários ) United Kingdom

ID do Projeto: #2965232

33 freelancers estão ofertando em média $17 para este trabalho

progwriter

See private message.

$42.5 USD in 5 dias
(620 Comentários)
7.7
mihaiscortaru

See private message.

$16.99 USD in 5 dias
(159 Comentários)
6.0
gedelsteinvw

See private message.

$17 USD in 5 dias
(6 Comentários)
5.6
DIBarit

See private message.

$12.75 USD in 5 dias
(116 Comentários)
5.4
dotcomweavers

See private message.

$42.5 USD in 5 dias
(34 Comentários)
5.3
simik

See private message.

$12.75 USD in 5 dias
(40 Comentários)
4.9
michaeldweber

See private message.

$25.5 USD in 5 dias
(35 Comentários)
4.6
sitemakker

See private message.

$17 USD in 5 dias
(18 Comentários)
4.4
vw943046vw

See private message.

$11.05 USD in 5 dias
(14 Comentários)
3.9
ssajithvw

See private message.

$17 USD in 5 dias
(16 Comentários)
3.6
zebrasus

See private message.

$12.75 USD in 5 dias
(11 Comentários)
3.6
gmorkster2

See private message.

$3.83 USD in 5 dias
(16 Comentários)
3.9
felenkavw

See private message.

$8.5 USD in 5 dias
(26 Comentários)
3.4
mihaidanila

See private message.

$4.25 USD in 5 dias
(12 Comentários)
3.3
simtechs

See private message.

$25.5 USD in 5 dias
(11 Comentários)
2.9
inspiredvw

See private message.

$29.75 USD in 5 dias
(1 Comentário)
2.9
cybermundos

See private message.

$25.5 USD in 5 dias
(5 Comentários)
2.8
sixi

See private message.

$34 USD in 5 dias
(11 Comentários)
2.7
webittechvw

See private message.

$3.4 USD in 5 dias
(10 Comentários)
2.6
infiwebcon

See private message.

$8.5 USD in 5 dias
(1 Comentário)
2.5