Qued Posted September 8, 2005 Report Share Posted September 8, 2005 Tātad, vajag aizvietot __teksts__ ar tipa <b>teksts</b>, tikai es te ar css vairāk darbojos. Uzrakstīju šitādu: $tmp_comment=ereg_replace('__([^_.]*)__','<span style="text-decoration: underline;">\\1</span>',$tmp_comment); Bet ir problēma: kā lai šim pasaka, lai neignorē tekstu, kam pa vidu ir viena _ zīme? Tipa __mans_auto__ šitā izteiksme neņem vērā. Domāju, domāju, bet neizdomāju. Link to comment Share on other sites More sharing options...
Delfins Posted September 8, 2005 Report Share Posted September 8, 2005 (edited) $tmp_comment = 'mans __labais__auto__ haha'; print preg_replace('/(__(.*?)__)/','<b>\2</b>',$tmp_comment); mans __labais_auto__ haha __das ist cool__. woot woot => mans <b>labais_auto</b> haha <b>das ist cool</b>. woot woot Edited September 8, 2005 by Delfins Link to comment Share on other sites More sharing options...
Qued Posted September 8, 2005 Author Report Share Posted September 8, 2005 superb, liels paldies! A ko es darīju nepareizi? Nevajadzēja vispār likt "^_"? Link to comment Share on other sites More sharing options...
Delfins Posted September 8, 2005 Report Share Posted September 8, 2005 (edited) (__kaut..kas__) 1.) Vispirms meklējam ko mums vajag (__...__) 2.) Saskaldam pa daļām cik nu sīki mums vajag (__(...)__) Edited September 8, 2005 by Delfins Link to comment Share on other sites More sharing options...
Recommended Posts