ezis Posted May 19, 2010 Report Share Posted May 19, 2010 Hei.. Doma taisit patauju skriptu ~ shaadi: [at]atbilde[/at][at]atbilde2[/at] tad ar preg split iegut: atbilde, atbilde2. un ar ciklu samest ieksh db atbilzu variantus. Bet problema ir ar preg_split patternu (laikam ta to sauc). kads butu pareizais patterns manam gadijumam? :? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted May 19, 2010 Report Share Posted May 19, 2010 Ja jau izmanto tagus šādā formā [tags][/tags], tad varbūt uzreiz izmanto BBCode klases un miers? Quote Link to comment Share on other sites More sharing options...
Леший Posted May 19, 2010 Report Share Posted May 19, 2010 \[at\].+\[/at\] Quote Link to comment Share on other sites More sharing options...
ezis Posted May 19, 2010 Author Report Share Posted May 19, 2010 (edited) Ja jau izmanto tagus šādā formā [tags][/tags], tad varbūt uzreiz izmanto BBCode klases un miers? Neesmu parliecinats, ka ar tam klasem vares panakt to, ko es velos.. btw, vesala klase prieksh viena aptauju skripta? oO @Леший: uzmet erroru par delimiter. Edited May 19, 2010 by ezis Quote Link to comment Share on other sites More sharing options...
Леший Posted May 19, 2010 Report Share Posted May 19, 2010 iespējams, ka / priekšā arī ir jāliek \. Like that: \/ Quote Link to comment Share on other sites More sharing options...
emsy Posted May 19, 2010 Report Share Posted May 19, 2010 Sākumā un beigās vajag /, bet vnk sintaksē izmantotos simbolus vajag eskeipot ar \ Quote Link to comment Share on other sites More sharing options...
ezis Posted May 19, 2010 Author Report Share Posted May 19, 2010 man skiet, ka vajadzetu but kkaa taa: /\[at\](tikai seit trukst kkas :\)\[\/at\]/ Quote Link to comment Share on other sites More sharing options...
ezis Posted May 19, 2010 Author Report Share Posted May 19, 2010 BUMP! nuu kkas tads samurgojaas: $str = "bla bla bla<at>atbilde</at> <at>atbilde2</at> bla bla blaa"; $arr = preg_split("/<[at>]*[at\/]>/",$str); print_r($arr); Array ( [0] => bla bla bla [1] => atbilde [2] => atbilde2 bla bla blaa ) Regular Expressions n00bs.. :\ Jautajums ir: kaa lai tiek valja no bla bla bla un bla bla blaa? man izdevas tikai tikt valja no atbilde un atbilde 2 :\ Quote Link to comment Share on other sites More sharing options...
marcis Posted May 19, 2010 Report Share Posted May 19, 2010 preg_split() tev tur vispār nav vajadzīgs $str = 'bla bla bla<at>atbilde</at> <at>atbilde2</at> bla bla blaa'; $mathces = array(); preg_match_all('/<at>(.+)<\/at>/U', $str, $matches); print_r($matches[1]); Quote Link to comment Share on other sites More sharing options...
ezis Posted May 19, 2010 Author Report Share Posted May 19, 2010 preg_split() tev tur vispār nav vajadzīgs $str = 'bla bla bla<at>atbilde</at> <at>atbilde2</at> bla bla blaa'; $mathces = array(); preg_match_all('/<at>(.+)<\/at>/U', $str, $matches); print_r($matches[1]); taisniba, nav gan vajadzigs ^^ sakuma gribeju taisit, lai butu bez tagiem, vienkarsi katru atbildi atdalot ar attiecigiem siboliem, bet tas likas nepiemeroti. btw paldies. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.