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:

£[url removed, login to view] becomes [url removed, login to view] (no currency symbol)

$[url removed, login to view] becomes [url removed, login to view] (rounded up and, again, no currency symbol)

1,[url removed, login to view] becomes 1000 (no comma - trailing .00 optional)

etc.

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

[url removed, login to view]

£££[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: uses regular expressions, regular expressions example, regular expression function, regular expression code, example regular expressions, example regular expression, regular expression example, php symbol, regular, expression, currency source code, currency javascript, php expression, javascript comma decimal, regular expressions javascript, javascript decimal format, value engineering, javascript variable php, javascript php function, javascript decimal comma example, javascript alert form, javascript alert price, php code currency, php rounded code, code rounded php

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