Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preg_match, problem
toth
post
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 27.12.2004

Ostrzeżenie: (0%)
-----


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
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
misterLu
post
Post #2





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 27.08.2004

Ostrzeżenie: (0%)
-----


$ 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,
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 21:02