Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: preg_match, problem
Forum PHP.pl > Forum > PHP
toth
witam i od razu przejde do sedna bo pozno snitch.gif

chce wyciagnac wartosc przypisane do etykiet.
mam 2 pytania czy to co robie nizej jest optymalne?
jak za pomoca reg_exp odnalezc znak konca linii?

Cytat
READS-000003/SEC WRITES-000001/SEC HIT RATIO-045%
STORAGE-010%



  1. <?php
  2.  
  3. preg_match('#READS[-]([0-9]*)[/]SEC[ ]*WRITES[-]([0-9]*)[/]SEC[ ]*HIT[ ]*RATIO[-]([0-9]*)[%][ ][*]*STORAGE[-]([0-9]*)[%][ ]*#', $line, $line2);
  4.  
  5. ?>


dziekuje i pozdrawiam
toth
misterLu
$ This is the "end of line" symbol. When used immediately before the ending delimiter, it signifies "at the end of the line". For instance:

$string =~ m/Bill Clinton$/; #true only when "Bill Clinton" is the last text in the string

źródło:
http://www.troubleshooters.com/codecorn/littperl/perlreg.htm

funkcje preg_* obsługują perlowe wyrażenia regularne,
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.