On 12/12/2012 3:47 PM, Maciek Sokolewicz wrote:
On 12-12-2012 21:10, Curtis Maurand wrote:
On 12/12/2012 12:00 PM, Maciek Sokolewicz wrote:
On 12-12-2012 17:11, Curtis Maurand wrote:
I have several poisoned .js files on a server. I can use find to
recursively find them and then use preg_repla
On 12-12-2012 21:10, Curtis Maurand wrote:
On 12/12/2012 12:00 PM, Maciek Sokolewicz wrote:
On 12-12-2012 17:11, Curtis Maurand wrote:
I have several poisoned .js files on a server. I can use find to
recursively find them and then use preg_replace to replace the string.
However the string is f
On 12/12/2012 12:00 PM, Maciek Sokolewicz wrote:
On 12-12-2012 17:11, Curtis Maurand wrote:
I have several poisoned .js files on a server. I can use find to
recursively find them and then use preg_replace to replace the string.
However the string is filled with single quotes, semi-colons and a
Maciek Sokolewicz wrote:
>On 12-12-2012 17:11, Curtis Maurand wrote:
>> I have several poisoned .js files on a server. I can use find to
>> recursively find them and then use preg_replace to replace the
>string.
>> However the string is filled with single quotes, semi-colons and a
>lot
>> of o
On 12-12-2012 17:11, Curtis Maurand wrote:
I have several poisoned .js files on a server. I can use find to
recursively find them and then use preg_replace to replace the string.
However the string is filled with single quotes, semi-colons and a lot
of other special characters. Will
preg_relace
On 06/02/2010 04:28 PM, Sam Smith wrote:
> $string = 'text with no newline';
> $pattern = '/(.*)/';
> $replacement = '${1}XX\nNext line';
> $string = preg_replace($pattern, $replacement, $string);
> echo $string;
>
> Outputs:
> text with no newlineXX\nNext line
> Instead of:
> text with no newline
Didn't seem to make it the first time.
Shawn McKenzie wrote:
> דניאל דנון wrote:
>> Lets assume I have the string "cats i saw a cat and a dog"
>> i want to strip everything except "cat" and "dog" so the result will be
>> "catcatdog",
>> using preg_replace.
>>
>>
>> I've tried something like /[^(d
דניאל דנון wrote:
> Lets assume I have the string "cats i saw a cat and a dog"
> i want to strip everything except "cat" and "dog" so the result will be
> "catcatdog",
> using preg_replace.
>
>
> I've tried something like /[^(dog|cat)]+/ but no success
>
> What should I do?
>
Capture everythi
On Sat, Jun 13, 2009 at 5:16 PM, Al wrote:
>
>
> Al wrote:
>>
>> This preg_replace() should simply replace all "&" with "&" unless the
>> value is already "&"
>>
>> But; if $value is simple a quote character ["] I get ""e". e.g.,
>> "test" => "e;test"e;
>>
>> Search string and replace works as it s
Hi.
On Saturday 13 June 2009, Al wrote:
> I may not have been very clear. Feed it just "test" with the
> quotes. You should get back, "test" the same as you gave it. Instead,
> I get back "e;test"e;
Like Shawn, I have tried your code in isolation and only get the expected
results. I loo
Al wrote:
This preg_replace() should simply replace all "&" with "&" unless
the value is already "&"
But; if $value is simple a quote character ["] I get ""e". e.g.,
"test" => "e;test"e;
Search string and replace works as it should in Regex_Coach.
echo $value.'';
$value=preg_replace("%&(?
Shawn McKenzie wrote:
Al wrote:
This preg_replace() should simply replace all "&" with "&" unless
the value is already "&"
But; if $value is simple a quote character ["] I get ""e". e.g.,
"test" => "e;test"e;
Search string and replace works as it should in Regex_Coach.
echo $value.'';
$valu
Shawn McKenzie wrote:
Al wrote:
This preg_replace() should simply replace all "&" with "&" unless
the value is already "&"
But; if $value is simple a quote character ["] I get ""e". e.g.,
"test" => "e;test"e;
Search string and replace works as it should in Regex_Coach.
echo $value.'';
$valu
Al wrote:
> This preg_replace() should simply replace all "&" with "&" unless
> the value is already "&"
>
> But; if $value is simple a quote character ["] I get ""e". e.g.,
> "test" => "e;test"e;
>
> Search string and replace works as it should in Regex_Coach.
>
> echo $value.'';
> $value=preg_
What do you want out?
$txt = 'A promise is a debt. -- Irish Proverb'; =>
[1] $txt = 'A promise is a debt. --Irish Proverb';
OR [2] $txt = 'A promise is a debt. --IrishProverb';
for [1] $txt= preg_replace("%--\x20+%", '--', $txt); //The \x20+ is one or more
spaces
Rick Pasotto wrote:
I hav
Capitalize the first letter of a word: ucwords()[1]
Now, if it's just for practice, then you need a little change in you
code, since strtoupper('\\2') will give '\\2' (i.e. does nothing) and
the letter will remain the same. One way to do it would be
$text = 'hello world (any ...w
What I see in the page you sent is a [url] "bbcode-tag" that is not
closed (i.e. it has no [/url] or it's not displayed)
If that's not the problem, could you send some example that isn't
working (and some others that are working)
Michael wrote:
I am currently writing a forum system, but at
Is there any special reason why you want to solve this with regular
expressions? As far as I see, there's a couple of problems with your code,
a) $file = dog.txt should be $file = 'dog.txt',
b) $getOldValue has the _array_ resulting of parsing the INI file,
hence you should write $getOldVa
Is this the wrong forum for this question - or does no-one else have a clue
about this either?
At 09:43 AM 1/12/06, Frank Bax wrote:
As I understand the docs for preg_replace(), I can enclose an PCRE
expression in parenthesis and use a backreference in the replace string;
but it's not working
Thanks Greg,
That sorted that out nicely :-)
Dave Carrera
-Original Message-
From: greg [mailto:[EMAIL PROTECTED]
Sent: 09 May 2004 14:17
To: Dave Carrera
Subject: Re: preg_replace to delete all js code in string help needed
Dave Carrera wrote:
> $text2 = preg_replace("/]+>.*?<\/scrip
Thanks John! Sorry to pester you any more, but how can I match all Ascii
characters? I can't seem to find it on
'http://www.php.net/manual/en/pcre.pattern.syntax.php'
(The period is matching Ascii characters and giving me this)
Unexpected character in input: ' ' (ASCII=23) state=2
Also how many a
[EMAIL PROTECTED] (Electroteque) wrote in
news:[EMAIL PROTECTED]:
> yet another regex question how could i hange the value within the
> quotes with preg_replace
>
> php_value upload_max_filesize "5M"
>
>
$str = preg_replace("#php_value upload_max_filesize\s?['\"](.+?)[\"']#i",
"php_value upl
> The following line sort of works:
> $retVal =
> preg_replace("/(.*){parent.(.*)}(.*)/e","'\\1'.\$this->parentNode-
> >getProper tyValue('\\2').'\\3'",$retVal);
>
> However, if there are more than one string to replace it only works
> on the last one. So:
> caption = "the parent's coordinates are
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Gerard Samuel)
wrote:
> When you think you got it, you don't get it..
> Im trying to scan the link for =A-Z0-9_=, dump the '=' and evaluate the
> remainder as a defined constant.
> Yes its funny looking, but if I could get this going Im golden.
> From: James Taylor [mailto:[EMAIL PROTECTED]]
> Subject: Re: [PHP] Re: preg_replace("/^\//".. doesnt work?
>
> Err, that's what he wanted
>
> On Wednesday 20 February 2002 12:13 pm, you wrote:
> > Also note:
> >
> > "^" matches the beg
>
> > -Original Message-
> > From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
> > Subject: [PHP] Re: preg_replace("/^\//".. doesnt work?
> >
> >$a = "/test/";
> >$a = preg_replace("/^\//", "", $a
Also note:
"^" matches the beginning of the string, so "^\/"
will only match a "/" at the beginning of the
string (not the first occurence of "/")
> -Original Message-
> From: Philip Hallstrom [mailto:[EMAIL PROTECTED]]
> Subj
thanks!
On Feb 20 11:55, Philip Hallstrom wrote:
>$a = "/test/";
>$a = preg_replace("/^\//", "", $a);
>echo $a;
>
> Notice the difference in the second line...
>
> On Wed, 20 Feb 2002, John Ericson wrote:
>
> > Im having a weird regexp problem in PHP that I think is cor
$a = "/test/";
$a = preg_replace("/^\//", "", $a);
echo $a;
Notice the difference in the second line...
On Wed, 20 Feb 2002, John Ericson wrote:
> Im having a weird regexp problem in PHP that I think is correct but it
> doesnt appear to work.
>
> The code is this:
>
>
Mike,
Thanks for your input on this. I'm getting better at php, but it does take
time.
Thanks again,
Hugh
- Original Message -
From: "Mike Frazer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 30, 2002 4:53 PM
Subject: [PHP] Re: preg_
Okay that was quicker than I thought. Here's the code to find the nth
occurrance of a string within a string:
function strnpos($string, $search, $nth) {
$count = 0;
$len = strlen($string);
$slen = strlen($search);
for ($i = 0; $i < $len; $i++) {
if (($i + $slen) > $len) { return FALSE; }
NOTE: That was done very quickly and only works on single character
searches! I'm working on one that will find multi-character strings. Gimme
a few mins and email me off-list if you want it.
Mike
"Mike Frazer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
PHP gave us strpos() and strrpos(), which find the first and last occurrance
of something within a string. What they forgot was rather important:
finding the "n"th occurrance. I wrote some code you can add to your script
(or put it in a separate file and require() it) that provides just such a
f
In article <000801c1a9c5$26007460$017f@localhost>,
[EMAIL PROTECTED] (Hugh Danaher) wrote:
> What I am trying to do is have a line of text break at a "space" after
> reading 19 words. Having read the various methods of finding and replacing
> one character with another, I settled on preg
First of all, thanks to everyone who replied! I have several good
suggestions. Here is one that seems to work pretty well, to cover a
multitude of situations:
$msg =
eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])","\\1://\\2\\3", $msg);
The only problem is that if a correct
35 matches
Mail list logo