Regular expression PHP

OsomA

I just started to learn regular expression and i have one example like this ' 23.0003NOV14DIX '. I want to extract 23.00 and 03NOV14DIX.

I tried this:

       preg_match("/(?P<a>[0-9]\.[0-9]{2}+)\s+"
           ."(?P<supplierPrice>)[^\s]\s+/"

       , $line, $matches);

But it is not working. My idea was that extract digits until met character '.' and then another 2 digits and the rest

Venky

the following works.

\s*(?P<a>\d+\.\d{2})(?P<supplierPrice>[^\s]+)\s*

Demo

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related