RegExp: replace quote marks

This is a discussion on RegExp: replace quote marks within the alt.comp.lang.php forums, part of the PHP Programming Forums category; wrote the following test form to replace quote marks with empty string but I get back the original string with ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-27-2005
r
 
Posts: n/a
Default RegExp: replace quote marks

wrote the following test form to replace quote marks with empty string but I
get back the original string with the quotes replaced by backslashes. Can
anyone say why and suggest a fix?
I'm using Internet Explorer and php 4.3.10
Thanks.
R

<?
import_request_variables('p', 'h_');
$pattern = "/\"/";
$replacement = "";
$h_JobDescription=preg_replace($pattern, $replacement, $h_JobDescription);

?>
<html>
<body>

<form name="InfoJob" method="post" action="tst.php">

<input size="20" name="JobDescription" value="<?=$h_JobDescription?>">

<input type="submit" value="Submit New Job">
</form>

</body>
</html>


Reply With Quote
  #2 (permalink)  
Old 03-27-2005
Geoff Berrow
 
Posts: n/a
Default Re: RegExp: replace quote marks

I noticed that Message-ID: <i6qdnZ_2o588CtvfRVn-rA@comcast.com> from r
contained the following:

$h_JobDescription=preg_replace($pattern, $replacement,
stripslashes($h_JobDescription));

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Reply With Quote
  #3 (permalink)  
Old 03-27-2005
r
 
Posts: n/a
Default Re: RegExp: replace quote marks

Thank You!
....don't know how I would have stumbled across that in the PHP docs...
R

"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:2j7d41tbbk1f7s3ps6n6sf2415j7brctbo@4ax.com...
>I noticed that Message-ID: <i6qdnZ_2o588CtvfRVn-rA@comcast.com> from r
> contained the following:
>
> $h_JobDescription=preg_replace($pattern, $replacement,
> stripslashes($h_JobDescription));
>
> --
> Geoff Berrow (put thecat out to email)
> It's only Usenet, no one dies.
> My opinions, not the committee's, mine.
> Simple RFDs http://www.ckdog.co.uk/rfdmaker/



Reply With Quote
  #4 (permalink)  
Old 03-27-2005
Geoff Berrow
 
Posts: n/a
Default Re: RegExp: replace quote marks

I noticed that Message-ID: <w6KdncFjLMWgj9rfRVn-1Q@comcast.com> from r
contained the following:

>Thank You!
>...don't know how I would have stumbled across that in the PHP docs...



Read up on 'magic quotes'.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:54 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0