FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » not understanding pattern matching
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: not understanding pattern matching [message #178614 is a reply to message #178613] Wed, 11 July 2012 23:31 Go to previous messageGo to previous message
Michael Joel is currently offline  Michael Joel
Messages: 42
Registered: October 2011
Karma:
Member
Michael Fesser wrote:

> .oO(Michael Joel)
>
>
>> Michael Fesser wrote:
>>
>>
>>> .oO(Michael Joel)
>>>
>>>
>>>
>>>> I am wanting to change words in a string that has special tags.
>>>> Ex. "This is a %/i%special%i% word in the string."
>>>> If I want to replace any word between the %/i% and %i% what would I do?
>>>>
>>>> I messed with preg_repace but I couldn't understand the pattern system.
>>>
>>>
>>> What have you tried so far? Do you have any experiences with regular
>>> expressions?
>>>
>>> Micha
>>>
>>
>> I have tried many things but all return errors - mostly "unknown modifier".
>
>
> Which means syntax error.
>
> Please post your code.
>
> Micha
>
I was trying to just first get it to replace the exact thing typed. Then
move on to replacing any word within the %/i% and %i%

$Scripture="this is a %/i%test%i%";
preg_replace("%/i%test%i%","XXXXXXXX",$Scripture);

This errors with Unknown modifier t
I tried what I thought was escaping it by putting a \test but that just
messes up more. See I haven't a clue.

Mike
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Check out www.phpscribble.com
Next Topic: Lost $_SESSION in Google Chrome
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 27 07:32:56 GMT 2024

Total time taken to generate the page: 0.04835 seconds