Re: Help with Php and Regex



The.Relinator@xxxxxxxxx ha scritto:
I'm just wondering what the best way is to extract and display a
number from a html file.

I tried the following piece of code, however it does not work.

ereg('\d\.\d', $content, $reg);
echo $reg[0];
ereg() is a test function, it checks if a regexp matches a given string and returns a boolean.
You probably need ereg_replace($regexp, $substitute, $input); see the doc for details.

--
|\/|55: Mattia Gentilini e 55 cappuccini per svegliarsi (by Sigfrido)
|/_| ETICS project at CNAF, INFN, Bologna, Italy
|\/| www.getfirefox.com www.getthunderbird.com
* Using Mac OS X 10.4.9 powered by Cerebros (Core 2 Duo) *
.



Relevant Pages

  • Re: Script Need to check disk space on remote servers
    ... Is it possible to get SQL Server database and log information (like ... echo Checking drives on Server %%S... ... REM this part of the script generates an HTML file with all the ... REM and then launches it using the default browser. ...
    (microsoft.public.windows.server.scripting)
  • Re: Error checking on SaveAs
    ... Echo ... > I am working on an add-in that looks at an HTML file and pulls text from a ... > I have no illusions that this will get all possible illegal characters. ...
    (microsoft.public.word.vba.userforms)
  • Re: $_POST array returns no data
    ... the array returns 0 no matter what I send ... is in the same folder as the .html file. ... As for trying just "echo ...
    (comp.lang.php)
  • Script Need to check disk space on remote servers
    ... echo Checking drives on Server %%S... ... REM this part of the script generates an HTML file with all the ... REM and then launches it using the default browser. ...
    (microsoft.public.windows.server.scripting)
  • Re: help understanding an ereg expression
    ... means match one character in the set between the brackets. ... echo 'matches!'; ... this ereg is clearly wasn't written for any PHP function. ...
    (comp.lang.php)