Re: regex help...again
| From: | elias | Date: | Fri, 30 Mar 2001 19:09:34 +0000 |
| Subject: | Re: regex help...again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46238@lists.php.net to get a copy of this message | ||
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```value3hehe!`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=$str<br>";
echo "matched: $match<br>\n";
}
?>
-
""David Balatero"" <db@icegaming.com> wrote in message
news:LHEJIKDFKMHLGMPILEDFMEGACAAA.db@icegaming.com...
> 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`valuevalue2`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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>