Re: [PHP] regex help...again
On Friday 30 March 2001 06:47, you wrote: Ok, i have a text file with lines that looks like this: 14```value```value2`value3 This would be fine, except...there are sometimes more than in other columns, so id like it to be 14``value``value2``value3 $new = preg_replace ('/`+/', '``', $old); quite simple, eh? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "World domination. Fast." (Linus Torvalds about Linux) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] regex help...again
So as you seem to be good with regexps, can you tell me how i can write a code that will search for next occurence in a string? where pattern is a regexp and a string is long and ofcourse there will be lots of pattern matchs in it...? thanks "Christian Reiniger" [EMAIL PROTECTED] wrote in message 01033011550005.07394@chrisbig">news:01033011550005.07394@chrisbig... On Friday 30 March 2001 06:47, you wrote: Ok, i have a text file with lines that looks like this: 14```value```value2`value3 This would be fine, except...there are sometimes more than in other columns, so id like it to be 14``value``value2``value3 $new = preg_replace ('/`+/', '``', $old); quite simple, eh? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) "World domination. Fast." (Linus Torvalds about Linux) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] regex help...again
On Saturday 31 March 2001 00:07, you wrote: So as you seem to be good with regexps, can you tell me how i can write a code that will search for next occurence in a string? where pattern is a regexp and a string is long and ofcourse there will be lots of pattern matchs in it...? What about simply using preg_match_all() ? Or do you specifically need the positions of the matches (instead of the values)? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] regex help...again
It's a lame way, but it works, I sure hope that someone can tell me how to do it in pure regexp. like how can i 'search for next occurence' in ereg or any regexp() in PHP - ? $str = "14```value```value2`value3``hehe!``hohoho"; while ( ereg("[^`]+", $str, $result) ) { $match = $result[0]; $pos = strpos($str, $match); for ($i = $pos; $i strlen($match)+$pos; $i++) $str[$i] = "`"; //echo "pos=$pos, matched: $match, str=$strbr"; echo "matched: $matchbr\n"; } ? - ""David Balatero"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Ok, i have a text file with lines that looks like this: 14```value```value2`value3 This would be fine, except...there are sometimes more than in other columns, so id like it to be 14``value``value2``value3 So I can explode() it into a mysql database. Can anyone offer a regexp for this? Thanks! David Balatero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]