Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
php preg_match - pojašnjenje

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
Kores



Joined: 10 Sep 2007
Posts: 20
Location: Zagreb

PostPosted: 05.03.2009 12:46    Post subject: php preg_match - pojašnjenje Add user to your forum ignore list Reply with quote

Pozdrav svima,
po prvi put sam se srela s preg_match funkcijom u php-u.
u manualu sam našla pojašnjenje i u principu je sve jasno, ali opet nije Confused
svi oni znakovi:
npr. @^(?:

malo zbunjuju. Embarassed
uopće ne kužim kak da sama napravim neko slaganje. primjere donekle kužim i onda idem sama i više niš ne valja.
ima li tko vremena da malo pojasni onaj dio 'pattern':

preg_match ( $pattern , $subject, $matches)

Hvala unaprijed Rolling Eyes
Pozdrav...
Back to top
View user's profile Send private message
base



Joined: 12 Jul 2007
Posts: 96

PostPosted: 05.03.2009 13:37    Post subject: Add user to your forum ignore list Reply with quote

preg_match traži neki uzorak u stringu i vraća broj koliko se puta uzorak u stringu puta poklopi

ovo je najjednostavniji primjer koji javlja ima li uopće pattern-a:

Code:
<?php
// The "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match("/php/i", "PHP is the web scripting language of choice.")) {
    echo "A match was found.";
} else {
    echo "A match was not found.";
}
?>


ovdje bi pattern bio riječ php bez obzira na velika ili mala slova...
Back to top
View user's profile Send private message
base



Joined: 12 Jul 2007
Posts: 96

PostPosted: 05.03.2009 13:39    Post subject: Add user to your forum ignore list Reply with quote

što se tiče ovih znakova koji te zbunjuju, check this:

http://www.phpf1.com/tutorial/php-regular-expression.html
Back to top
View user's profile Send private message
Kores



Joined: 10 Sep 2007
Posts: 20
Location: Zagreb

PostPosted: 05.03.2009 14:52    Post subject: Add user to your forum ignore list Reply with quote

super! zbunjenost prošla Very Happy
HVALA!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group