Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6542

Re: not understanding pattern matching

From BootNic <bootnic.bounce@gmail.com>
Newsgroups comp.lang.php
Subject Re: not understanding pattern matching
Date 2012-07-11 21:32 -0400
Organization BootNic Party Make your vote count!
Message-ID <20120711213252.6c7021db@bootnic.server> (permalink)
References <vKadnRzba_frYmDSnZ2dnUVZ_qGdnZ2d@earthlink.com> <2k0sv7dto2p429rl73r9n7hna7e06sh0jk@mfesser.de> <7didnTrFNO5ummPSnZ2dnUVZ_q-dnZ2d@earthlink.com> <4p2sv71t7ak9hg1tk2jglnrvgl9ri7mpnc@mfesser.de> <V5KdnVyG6ph9kWPSnZ2dnUVZ_uWdnZ2d@earthlink.com>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

In article <V5KdnVyG6ph9kWPSnZ2dnUVZ_uWdnZ2d@earthlink.com>,
Michael Joel <null@void.void> wrote:

> 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?
>>> 
>>> I have tried many things but all return errors - mostly "unknown modifier".
>> 
>> Which means syntax error.
>> 
>> Please post your code.
>
> 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);

[url] http://php.net/manual/en/regexp.reference.delimiters.php [/url]

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.



-- 
BootNic                                               Wed Jul 11, 2012 09:32 pm
  When I was young, I was put in a school for retarded kids for two years before
  they realized I actually had a hearing loss...and they called ME slow!
  *Kathy Buckley*

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

not understanding pattern matching Michael Joel <null@void.void> - 2012-07-11 18:35 -0400
  Re: not understanding pattern matching Michael Fesser <netizen@gmx.de> - 2012-07-12 00:49 +0200
    Re: not understanding pattern matching Michael Joel <null@void.void> - 2012-07-11 19:11 -0400
      Re: not understanding pattern matching Michael Fesser <netizen@gmx.de> - 2012-07-12 01:26 +0200
        Re: not understanding pattern matching Michael Joel <null@void.void> - 2012-07-11 19:31 -0400
          Re: not understanding pattern matching BootNic <bootnic.bounce@gmail.com> - 2012-07-11 21:32 -0400
          Re: not understanding pattern matching Denis McMahon <denismfmcmahon@gmail.com> - 2012-07-13 03:22 +0000
    Re: not understanding pattern matching Michael Joel <null@void.void> - 2012-07-11 19:11 -0400
  Re: not understanding pattern matching Michael Joel <null@void.void> - 2012-07-11 23:27 -0400

csiph-web