Regular expressions
| From: | Sheni R. Meledath | Date: | Thu, 27 Nov 2003 09:20:57 +0000 |
| Subject: | Regular expressions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171181@lists.php.net to get a copy of this message | ||
Hi,
Could anybody help me to create a regular expression to remove a pattern from a string.
$querystring = http://10.100.1.7/cdms/prfl.phtml?action=search&custtype=1&gender=&x=22&y=10&page=2
I would like to remove "&page=2" from this query string. The page number changes. That is the reason why I want to use regular expression to replace the variable & value from the string.
Now I am using this option to remove the variable name only, so that it will not collide with the variable value that is submitted again.
$qstring = eregi_replace("page=","",$querystring);
Sheni R Meledath
sheni@cyber-gear.com