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
Maciek Sokolewicz maciek.sokolew...@gmail.com 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,
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
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
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
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 newlineXX
Next
דניאל דנון 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 everything but only
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 /[^(dog|cat)]+/ but no
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 quote;testquote;
Like Shawn, I have tried your code in isolation and only get the expected
results. I
On Sat, Jun 13, 2009 at 5:16 PM, Aln...@ridersite.org wrote:
Al wrote:
This preg_replace() should simply replace all with amp; unless the
value is already amp;
But; if $value is simple a quote character [] I get quote. e.g.,
test = quote;testquote;
Search string and replace works as it
Al wrote:
This preg_replace() should simply replace all with amp; unless
the value is already amp;
But; if $value is simple a quote character [] I get quote. e.g.,
test = quote;testquote;
Search string and replace works as it should in Regex_Coach.
echo $value.'br /';
Shawn McKenzie wrote:
Al wrote:
This preg_replace() should simply replace all with amp; unless
the value is already amp;
But; if $value is simple a quote character [] I get quote. e.g.,
test = quote;testquote;
Search string and replace works as it should in Regex_Coach.
echo $value.'br
Shawn McKenzie wrote:
Al wrote:
This preg_replace() should simply replace all with amp; unless
the value is already amp;
But; if $value is simple a quote character [] I get quote. e.g.,
test = quote;testquote;
Search string and replace works as it should in Regex_Coach.
echo $value.'br
Al wrote:
This preg_replace() should simply replace all with amp; unless
the value is already amp;
But; if $value is simple a quote character [] I get quote. e.g.,
test = quote;testquote;
Search string and replace works as it should in Regex_Coach.
echo $value.'br /';
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 have
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
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
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
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 =
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
[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
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.
$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:
$a =
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 correct but it
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]]
Subject: [PHP] Re: preg_replace(/^\//.. doesnt work?
$a = /test
PROTECTED]]
Subject: [PHP] Re: preg_replace(/^\//.. doesnt work?
$a = /test/;
$a = preg_replace(/^\//, , $a);
echo $a;
On Wed, 20 Feb 2002, John Ericson wrote:
I want preg_replace to replace the first '/' in $a with '' so that the
echo function echoes test
] 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 beginning of the string, so ^\/
will only match a / at the beginning of the
string (not the first occurence of /)
--
PHP General Mailing
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
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 nth 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
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]...
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; }
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_replace() 'space' the final frontier
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:]#?/=]),a
href=\\\1://\\2\\3\ target=\_blank\\\1://\\2\\3/a, $msg);
35 matches
Mail list logo