...redirect people visiting the old URLs to the new ones. This is the closest I think I got, but doesn't work:
RewriteEngine on
RewriteRule ^\/(\w)(.*)$ /$1/$1$2 [R=301,L]
Or
RewriteEngine on
RewriteRule ^\/viri\/(\w)(.*)$ /viri/$1/$1$2 [R=301,L]
I have the R=301 as I want this to be a...
Hello,
Here is what I want to do. I have this string for example:
$text="THIS bla blaTHIS bla THISbla THIS THIS";
Now what I'm trying to do is match only those "THIS" that are separate words and NOT part of other words and replace it with THAT. For example the above should become...
Yes, I also don't use IE much. I found that by testing the code in my PHP editor (from www.dzsoft.com) which has an in-built browser.
As for the DOM approach: I haven't got any experience with DOM, will read the manual at http://php.net/dom and see if I can get it to work.
Regards,
c4n
Hi,
EasyPHP (http://www.easyphp.org/) is also installs Apache, PHP, mySQL and phpMyAdmin on Windows computers. This or phpdev should be easier to use if you are just starting, but as atsea said don't be afraid to install all this manually.
Regards,
c4n
Hi again Lrnmore,
I found a little problem with this part of the RE:
([^src]*)
This doesn't match "src" exactly. If you input a code like this:
$test = <<<END
<iframe scrolling="0" src="http://www.google.com"></iframe>
END;
it brakes on scrolling="" (note the "scr" which is not "src" but...
...the replaced part. I believe this will save CPU/memory if many HTML pages are parsed.
This is what I'll be using:
$pattern = "/(<iframe )([^src]*)(src=)([\'\"]?)([^>\s\'\"]+)([\'\"]?)/ie";
$tmp = preg_replace($pattern,'stripslashes("\\1\\2\\3\\4".str_replace("\\5", "http://www.yahoo.com"...
...replaced.
I tried using VARIOUS regular expressions but always it works just in some cases. For example I tried:
$pattern = "/<iframe ([^>]*)src=['\"]*([^'\s\">]*)['\"\s]+([^>]*)>(.*)<\/iframe>/Uis";
$pattern = "/<iframe ([^>]*)src=(.*)\s([^>]*)>(.*)<\/iframe>/Uis";
and others...
Any...
Wow, many thanks, this indeed is a simpler solution that my function :)
Heh, I'm a self-taught programmer and while most of the time I get everything working I usually end up with a complicated function like the one above ;)
Thanks again!
...list($end_year,$end_month,$end_day)=explode('-',$stop);
for ($year=$start_year; $year<=$end_year; $year++) {
if ($year==$start_year) {
/* Start with start month */
$start_months_at=$start_month;
} else {
/* Start at first day of the month */
$start_months_at=1;
}
if ($year==$end_year) {
/*...
Hi all,
Thanks to all for posting this, much appreaciated. I will dig through your codes and I am sure I will learn new things abour RE.
Thanks again!
Regards,
c4
Hi Mark,
Thanks for posting.
Unfortunately I can't use that code because it isn't necessary the initial string ($str in your case) will be nicely formatted. It can be
$str = <<<END
some text1,some text2,some text3A{some text1,some text2,some text3}
some text1,some text2,some text3B{some...
...is a more fancy way of doing it ;-)
CODE:
$a="
some text1,some text2,some text3
{
some text1,some text2,some text3
}
";
$b=preg_replace("/[^{]*(\{[^}]*\})/","###HERE###$1",$a);
$c=preg_replace("/([^{]*)\{[^}]*\}/","$1#S#",$a);
$tochange=explode('#S#',$c);
foreach ($tochange as $k=>$v) {...
Hi all,
I've been trying to figure this one out but can't seem to get it. Here's the situation:
I have some text like this:
some text1,some text2,some text3
{
some text1,some text2,some text3
}
What I want to do is add space after the comma (,) OUTSIDE the { }
So the above text should...
Hello,
When I type "www.mydomain.com" in my IE6 browser on Windows 98 I want the browser to open a local folder on my PC and not actually conect to www.mydomain.com
For example I type "www.mydomain.com" in my browser and the browser should open
C:\My documents\web\index.html
instead of...
Hello and sorry for the late reply. I didn't know about the PHP_OS thing, thanks! Looks nice, will test it on different servers and probably be able to use it.
Thanks again!
Regards
c4n
Hello,
Thanks for the replies. I am using $_SERVER['SERVER_SOFTWARE'] at the moment, just thought I'd ask if there is a better way...
If anyone knows any other way please let me know.
Regards,
c4n
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.