getting contents inbetween

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nymanish
Forum Newbie
Posts: 1
Joined: Mon Mar 15, 2004 1:43 am

getting contents inbetween

Post by nymanish »

I'm using this code for searching and replacing :

preg_match_all("/\{$WSCPAGELINK([^\}]*)\NAV}/U", $pageHtmlBody, $Matches);

and this works fine with php version older than 4.3.3.

But in new PHP version i'm getting this error:

Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 21

If i add 2 extra slashes just before NAV:
preg_match_all("/\{$WSCPAGELINK([^\}]*)\\\NAV}/U", $pageHtmlBody, $Matches);

this does not give any error messages, but now i'm not getting any result.

Basically, i want all the contents appearing in between {$WSCPAGELINK and NAV}.


Pls help
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: getting contents inbetween

Post by TheBentinel.com »

nymanish wrote: preg_match_all("/\{$WSCPAGELINK([^\}]*)\NAV}/U", $pageHtmlBody, $Matches);
What does the /U do? What happens if you take it out?
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

the U modifer reverses the characteristics of greedy operators, but I don't think this is the problem.

I'd be more inclined to suspect the \NAV e.g. remove any/all slashes directly before it so it is just NAV.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

just a thought, the new php (5) has stri_replace, like str_replace and like eregi_replace(without expressions) if you can use that.
Post Reply