Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: c4n
  • Order by date
  1. c4n

    Mod rewrite to redirect into subdirectories by first letter

    ...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...
  2. c4n

    RegEx: matching a word not part of another one

    Wow, how simple. I was complicating things too much because I didn't know of the \b for word boundary. Thanks, I learned a lot new today!
  3. c4n

    RegEx: matching a word not part of another one

    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...
  4. c4n

    RegExp: Replace SRC attribute from <iframe>

    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
  5. c4n

    Global Constants

    Hi, what are the lines 2 and 3 in index.tpl.php? Regards, c4n
  6. c4n

    Testing PHP pages

    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
  7. c4n

    RegExp: Replace SRC attribute from <iframe>

    ...scrolling="0" height="240" src="http://www.yahoo.com" name="test"></iframe> END; $nwURL = "http://www.ask.com"; $pattern = "/(<iframe .*src=([\'\"]?))([^>\s\'\"]+)([\'\"]?)/is"; $tmp = preg_replace($pattern,"\\1".$nwURL."\\4",$test); echo stripslashes($tmp); If you (or anyone else) have...
  8. c4n

    RegExp: Replace SRC attribute from &lt;iframe&gt;

    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...
  9. c4n

    RegExp: Replace SRC attribute from &lt;iframe&gt;

    ...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"...
  10. c4n

    RegExp: Replace SRC attribute from &lt;iframe&gt;

    ...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...
  11. c4n

    List all dates between a start and end date

    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!
  12. c4n

    List all dates between a start and end date

    ...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) { /*...
  13. c4n

    Help with regular expression

    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
  14. c4n

    Help with regular expression

    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...
  15. c4n

    Help with regular expression

    ...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) {...
  16. c4n

    Help with regular expression

    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...
  17. c4n

    setting up domain.com on local computer

    Thanks, I got it working. Regards
  18. c4n

    setting up domain.com on local computer

    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...
  19. c4n

    Detecting server OS

    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
  20. c4n

    Detecting server OS

    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

Part and Inventory Search

Back
Top