Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Czy ciąg zawiera ....
-lines-
post
Post #1





Goście







Cześć !
Dopiero zaczynam z php i potrzebuje sprawdzić, czy w zmienna zawiera tylko litery, cyfry i znak /, a niemiem jak.
Pomoze ktoś ?
Go to the top of the page
+Quote Post
crash
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

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


Najszybciej za pomocą wyrażeń regularnych...
  1. <?php
  2. if( preg_match( '#^[a-z0-9/]$#i', $zmienna ) == true )
  3. {
  4. // zmienna zawiera tylko litery, cyfry i znak /
  5. }
  6. ?>


--------------------
Go to the top of the page
+Quote Post
-lines-
post
Post #3





Goście







Dzięki Crash !
Go to the top of the page
+Quote Post
-lines-
post
Post #4





Goście







wpisałem coś takiego i nie działa sad.gif
  1. <?php
  2. if( preg_match( '#^[a-z0-9/]$#i', 'test15/4' ) == true )
  3. {
  4. print('ok');
  5. }
  6. ?>
Go to the top of the page
+Quote Post
ghostrider
post
Post #5





Grupa: Zarejestrowani
Postów: 135
Pomógł: 0
Dołączył: 30.09.2005
Skąd: k-rk

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


  1. <?php
  2. if( preg_match( '#^[a-z0-9/]+$#i', 'test15/4' ) )
  3. {
  4. print('ok');
  5. }
  6. ?>


mały + za nawiasek, i git


--------------------
There are 10 types of people in the world:
-Those who understand binary, and those who don't...
There's no place like 127.0.0.1
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 - 17:33