PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old July 24th, 2002, 12:51 PM
spolarium spolarium is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 spolarium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Regular Expressions - php

This one is from a friend who is converting his .asp expressions into php:

Why doesn't this work with PHP? It works great on ASP.

oRegExp.Global = TRUE
oRegExp.Pattern = "((.|n)*?)"
strInput = oRegExp.replace(strInput, "$1")

I got this to work on PHP but results are flaky and it's not global. It replaces all instances with just one instance.

$strOutput = eregi_replace("((.|n)*)", "\1", $strOutput);

Reply With Quote
  #2  
Old July 24th, 2002, 08:39 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: Regular Expressions - php

heh, regular expressions are never "flaky", they either work properly, or don't..

Anyhow :
php Code:
Original - php Code
  1. <?
  2.     $strOutput = "blah haha blahthree";
  3.     $strOutput = eregi_replace("\[i\](([^[])*)\[/i\]", "\1", $strOutput);
  4.     print($strOutput);
  5. ?>

Remember that php uses (backslash) as an escape character as does regex, so you need to escape them for php first.. Not so in ASP.

What do you mean, not global?

Reply With Quote
  #3  
Old July 25th, 2002, 12:37 AM
spolarium spolarium is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 spolarium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Regular Expressions - php

Thanks, man. Will forward your solution to my friend.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Regular Expressions - php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway