|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi I'm having trouble running the following preg_replace:
$thestring = preg_replace( '!<a href="javascript:radio('/0radio/ stream.php?radioID=(.*?)')" class="radioPlay">(.*?)</a>!' , "[radio:\\1]", $thestring ); Can anyone me escape the ' apostrophe? I've tried all combinations of \ in front of the ' characters but nothing seems to work. Cheers, Ciarán |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Ciaran wrote:
> Hi I'm having trouble running the following preg_replace: > > $thestring = preg_replace( '!<a href="javascript:radio('/0radio/ > stream.php?radioID=(.*?)')" class="radioPlay">(.*?)</a>!' , > "[radio:\\1]", $thestring ); > > Can anyone me escape the ' apostrophe? I've tried all > combinations of \ in front of the ' characters but nothing seems > to work. > > Cheers, > Ciarán Take a look at preg_quote() |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Apr 24, 7:52 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote: > Ciaran wrote: > > Hi I'm having trouble running the following preg_replace: > > > $thestring = preg_replace( '!<a href="javascript:radio('/0radio/ > > stream.php?radioID=(.*?)')" class="radioPlay">(.*?)</a>!' , > > "[radio:\\1]", $thestring ); > > > Can anyone me escape the ' apostrophe? I've tried all > > combinations of \ in front of the ' characters but nothing seems > > to work. > > > Cheers, > > Ciarán > > Take a look at preg_quote() Ah! Very handy! Thanks a lot! |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Ciaran wrote:
> On Apr 24, 7:52 pm, "Paul Lautman" <paul.laut...@btinternet.com> > wrote: >> Ciaran wrote: >> > Hi I'm having trouble running the following preg_replace: >> >> > $thestring = preg_replace( '!<a >> > href="javascript:radio('/0radio/ >> > stream.php?radioID=(.*?)')" class="radioPlay">(.*?)</a>!' , >> > "[radio:\\1]", $thestring ); >> >> > Can anyone me escape the ' apostrophe? I've tried all >> > combinations of \ in front of the ' characters but nothing >> > seems to work. >> >> > Cheers, >> > Ciarán >> >> Take a look at preg_quote() > > > Ah! Very handy! Thanks a lot! Although I always thought that preg_escape() would have been a better name. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
..oO(Paul Lautman)
>Ciaran wrote: >> On Apr 24, 7:52 pm, "Paul Lautman" <paul.laut...@btinternet.com> >> wrote: >> >>> Take a look at preg_quote() >> >> Ah! Very handy! Thanks a lot! > >Although I always thought that preg_escape() would have been a better name. function preg_escape($str, $delimiter = NULL) { return preg_quote($str, $delimiter); } SCNR Micha |
|
![]() |
| Outils de la discussion | |
|
|