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


Groups > comp.lang.php > #3040 > unrolled thread

php help

Started bybob <bob@coolgroups.com>
First post2011-08-31 15:23 -0700
Last post2011-09-01 10:44 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  php help bob <bob@coolgroups.com> - 2011-08-31 15:23 -0700
    Re: php help "A" <a@a.a> - 2011-09-01 00:48 +0200
    Re: php help "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-09-01 10:44 +0200

#3040 — php help

Frombob <bob@coolgroups.com>
Date2011-08-31 15:23 -0700
Subjectphp help
Message-ID<a69ee922-56bf-4e13-bc28-8a6db69c4701@o26g2000vbi.googlegroups.com>
I need some php help.

I need to replace &acirc; followed by two unknown characters with an
empty string.

I tried this, but it's not quite right:


$newstring=preg_replace ("/&acirc;??/i", "",$newstring);

Any ideas?

[toc] | [next] | [standalone]


#3041

From"A" <a@a.a>
Date2011-09-01 00:48 +0200
Message-ID<j3mdp5$rve$1@gregory.bnet.hr>
In reply to#3040
> $newstring=preg_replace ("/&acirc;??/i", "",$newstring);

You didn't specify what these unknown characters should be.
I am guessing non-whitespace. In that case this would be appropriate:

$newstring=preg_replace ('/&acirc;\S\S/i', '',$newstring);

So that would match:
&acirc;abcer

But wouldn't match:
&acirc; asdasd

or...
&acirc;a sdasd

Note the "single" quotes (apostrophe) instead of your double quotes (that 
don't need to escape backslash).

If you want to match anything then use:
$newstring=preg_replace ('/&acirc;../i', '',$newstring);

That would match any case of the above.

[toc] | [prev] | [next] | [standalone]


#3046

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2011-09-01 10:44 +0200
Message-ID<j3nglv$4vk$1@dont-email.me>
In reply to#3040
El 01/09/2011 0:23, bob escribió/wrote:
> I need some php help.
>
> I need to replace&acirc; followed by two unknown characters with an
> empty string.
>
> I tried this, but it's not quite right:

"Not quite right". Nice description. As useful as "Does not work" :)

>
>
> $newstring=preg_replace ("/&acirc;??/i", "",$newstring);

The "?" symbol means "any character" in Windows wildcards but not in 
regular expressions. You want "." instead:

<?php
var_dump( preg_replace ('/&acirc;../i', '', '&acirc;abKeep Me!') );



-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web