Maybe this can help :
pick up an array of variables from a query string such as:
http://www.archipro.com/test.php?state=AB&state=BC
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=3265
Sincerely
berber
Visit http://www.weberdev.com Today!!!
To see where PHP might take
Bas Jobsen wrote:
> Op donderdag 07 februari 2002 23:58, schreef Michael Kimsal:
>
>>Looking for a regex (preg or ereg) to remove
>>all 1, 2 and 3 character words.
>>
>
> $string="over deze regex loop ik nu al de hele dag en een uur te piekeren. 't
> wil niet! of wel! l'a.";
> $string=" ".$str
ot;.", $str);
$str = str_replace(",.", ".", $str);
echo $str;
-Original Message-
From: Douglas Maclaine-cross [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 11:09 AM
To: 'Edward van Bilderbeek - Bean IT'; Michael Kimsal;
[EMAIL PROTECTED]
;, $str);
$str = eregi_replace('^[a-z\']{1,3} ', '', $str);
$str = eregi_replace('^[a-z\']{1,3}([^a-z\'])', '\1', $str);
$str = eregi_replace(' [a-z\']{1,3}$', '', $str);
$str = eregi_replace('([^a-z\' ])[a-
m: "Bas Jobsen" <[EMAIL PROTECTED]>
To: "Michael Kimsal" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, February 08, 2002 1:10 AM
Subject: Re: [PHP] Regex function needed
> Op donderdag 07 februari 2002 23:58, schreef Michael Kimsal:
> > Looking
Op donderdag 07 februari 2002 23:58, schreef Michael Kimsal:
> Looking for a regex (preg or ereg) to remove
> all 1, 2 and 3 character words.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
To: [EMAIL PROTECTED]; Michael Kimsal
Subject: Re: [PHP] Regex function needed
this might even work beter, to take comma's and periods etecetera into
account to:
$str = "This is or was a test for short words, although an, should be
deleted to.";
while (ereg(" [a-z]{1,3} ", $s
})[a-z']{1,3}([ ]{1}|[,]{1}|[.]{1}
|[:]{1})", "\\2", $str);
}
Greets,
Edward
print $str;
- Original Message -
From: "Edward van Bilderbeek - Bean IT" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Michael Kimsal" <[EMAIL PRO
I don't know if this is the best way but:
$str = "This is or was a test for short words";
while (ereg(" [a-z]{1,3} ", $str)) {
$str = eregi_replace(" [a-z]{1,3} ", " ", $str);
}
print $str;
this replaces all occurences of a space followed by 1,2 or 3 alphabetic
characters followed by a space.
$string = ereg_replace("[A-Za-z']{1,3}", "", $string); // don't forget "I'm"
I haven't checked but something like this.
-Original Message-
From: Michael Kimsal [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 9:59
To: [EMAIL PROTECTED]
Subject: [PHP] Regex function needed
Lo
use
$rgTemp = split('[|]',$szTag);
instead of
$rgTemp = split("|",$szTag);
on line 2
PHP List wrote:
> Hi,
> Can someone please tell me why the this is happening:
>
> 1) $szTag = "test|3";
> 2) $rgTemp = split("|",$szTag);
> 3) $szTag = $rgTemp[0];
> 4) $nItemID = $rgTemp[1];
> ^lin
split() takes a regular expression,
this means you have to escape the | char with a \
like this:
$rgTemp = split("\|",$szTag);
bvr.
On Fri, 18 Jan 2002 14:40:25 -0800, PHP List wrote:
>Hi,
>Can someone please tell me why the this is happening:
>
>1) $szTag = "test|3";
>2) $rgTemp = spli
> As far as I can see (notice: I'm not a regex-king ;) the regex seems
correct
> to me. The only thing I'm wondering about is the "/^<" (second last line
of
> the citation). Together with your expression in the array it results in
> preg_match("/<\/ I'm wondering if that ( not only
> > If you want the [ to be escaped in the regex you have to "double-escape"
> it:
> > $x = "\ \["; (sorry, the two \ should be together without a space but my
> > stupid mail-app converts the string thinking it's an network address)
> > so $x will contain "\[" as you want ( the first backslash e
> If you want the [ to be escaped in the regex you have to "double-escape"
it:
> $x = "\ \["; (sorry, the two \ should be together without a space but my
> stupid mail-app converts the string thinking it's an network address)
> so $x will contain "\[" as you want ( the first backslash escapes the
> Hi all,
>
> I've got a regex that's working fine, apart from one little problem.
>
> $tags = array ("script",
>"");
A quick shot (perhaps I miss the point ;): if you do
$x = "\[";
then $x will contain "[". If you then do a regex with preg_match("/$x/",
..." eg. then it get's eva
The code below does almost of the job. There is only one problem. If some path is
absolute to the server /aaa/bbb/ the path get
file://aaa// but I think no problems with apache.
HTH
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS
a URL,
a link to an external JS
Hey thanks! That was a good starting point...
-Brian
> -Original Message-
> From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 10, 2001 9:35 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] RegEx gurus help...
>
>
>
from the way you describe, i can't help but think that it'd be one hell of a
regex.if all you're doing is stripping out .. i'd load up your fav
editor and do a search and replace where you can approve each changeor,
just change them all and fix what's broken.it'll be much quicker than
> My solution:
> ereg("^[:space:]*\*",$variable)
Try
ereg("^[:space:]\**$",$variable)
or
ereg("^[ ]*\**$",$variable)
or
ereg("^[[:space:]]*\**$",$variable)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECT
preg_match('/ Hi
>
> How does one extract a URL from HTML like :
>
>
>
> I have an HTML file with many lines like this and I want to extract the
> /abc/def/0,1234,567.html?xxx=abcde part from each one.
> Assuming I can get the lines into an array, how can I extract only the
> URL part?
>
> I trie
In article
<[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Boaz Yahav) wrote:
> In case anyone is interested, eregi("HTTP/1.[01].302",$output) seems to
> work :)
"." == "any character" (including, but not necessarily, a period). If you
want to match a period, escape it or put it in square braces:
e
In case anyone is interested, eregi("HTTP/1.[01].302",$output) seems to
work :)
berber
-Original Message-
From: Boaz Yahav
Sent: Tuesday, July 31, 2001 2:03 PM
To: PHP General (E-mail)
Subject: [PHP] Regex question
I'm trying to find if a string exists inside a string. Instead of usin
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Dave) wrote:
> Am partially successfull after taking a further look into things. the
> following
> (while ugnly) correctly catches everything except the \ character for some
> reason. ideas?
>
> if(preg_match("/['".'" ,!@#$%\^&*()+=\/\\:;?|]
Am partially successfull after taking a further look into things. the following
(while ugnly) correctly catches everything except the \ character for some
reason. ideas?
if(preg_match("/['".'" ,!@#$%\^&*()+=\/\\:;?|]/',$MyString)){
# echo error, character found
}
>-Original Message
I think he means swap...
--
Lasse
"Jack Dempsey" <[EMAIL PROTECTED]> wrote in message
000601c10e81$03aca260$22ebd73f@2pqjp01">news:000601c10e81$03aca260$22ebd73f@2pqjp01...
> What exactly are you trying to do? "Switch around" in what way?
>
> Jack
>
> -Original Message-
> From: Alvin Ta
What exactly are you trying to do? "Switch around" in what way?
Jack
-Original Message-
From: Alvin Tan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 12:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex help
hi all,
a little OT here, but need some quick help. I have a bunch o
Sheridan,
I didn't test this in PHP, I'm more familiar with the Perl Regex, but this
might work for you, play with it:
/mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 9:04 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Regex Help
I am trying to write a script that needs a list of a
On Tuesday 10 July 2001 23:04, Jerry Lake wrote:
> the only pattern that they share is
> that the end of the line ends with a number,
> quotes and a closing bracket i.e. 7">
> I can match that pattern, with .\d"> but
> when I try to replace it, I also replace
> the number at the end, and not just
Previously, Gyozo Papp said:
> metacharacter.
>
> > Is a '.' inside of a [] a literal '.', or a 'any character'
A period inside a character class (i.e. inside a [] block) is just a
period, and not a metacharacter.
-dan
--
Don't let it end like this. Tell them I said something.
> > Is a '.' inside of a [] a literal '.', or a 'any character'
> metacharacter.
In what regex syntax? In POSIX (ereg_*) and in PCRE (preg_*):
[.]//match a period
\.//match a period
. //match one instance of any character (which could be a period)
[[.foo.]] //match string "foo" (
metacharacter.
- Original Message -
From: "Dennis Gearon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 22. 09:34
Subject: [PHP] regex
> Is a '.' inside of a [] a literal '.', or a 'any character'
> ?
> --
> --
if (preg_match_all("|testing(.*?);blah|s", $str, $matches))
{
// do what you want with $matches: see in the manual!
var_dump($matches);
}
- Original Message -
From: "George E. Papadakis" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: 2001. május 20. 19:18
Subject: [PHP] R
On Sunday 20 May 2001 19:18, George E. Papadakis wrote:
> I have an ereg question::.
> $data = a big string ,
> while (ereg ("testing([^;]*);blah(.*)",$data,$args)) {
> $this = $args[1];
> $data = $args[2];
> }
>
> What I wanna do ,obviously, is to get all the strings between 'testng'
> a
use match_all to get an array of matches.
$s = "[VET]We r NOT [PA]-Crew [TC]";
preg_match_all('/\[.*?\]/', $s, $matches);
while (list($k,$v) = each($matches[0])) {
print "$k = $v\n";
}
prints:
0 = [VET]
1 = [PA]
2 = [TC]
> -Original Message-
> From: Michael Roark [mailto:[
On Wednesday 18 April 2001 22:03, you wrote:
> and do various searches etc. I was curious as to what most people find
> the best way keep thier mysql queries from getting messed up by user
> entered data. None of my searches or database data has or needs any
Simply using addslashes () or the mag
I use a special function just for reforming input, but they use the
following bits with PCRE:
$replace_wordwhite = '/[^\w\s]/';
$replace_word = '/\W/';
$replace_num = '/\D/';
$replace_email = '/[^\w\-\.@]/';
Works pretty well and it's quite useful for killing useless input without
returning
On Saturday 31 March 2001 00:07, you wrote:
> So as you seem to be good with regexps, can you tell me how i can write
> a code that will search for next occurence in a string?
> where pattern is a regexp and a string is long and ofcourse there will
> be lots of pattern matchs in it...?
What about
So as you seem to be good with regexps, can you tell me how i can write a
code that will search for next occurence in a string?
where pattern is a regexp and a string is long and ofcourse there will be
lots of pattern matchs in it...?
thanks
"Christian Reiniger" <[EMAIL PROTECTED]> wrote in mess
On Friday 30 March 2001 06:47, you wrote:
> Ok, i have a text file with lines that looks like this:
>
> 14```value```value2`value3
>
> This would be fine, except...there are sometimes more than in
> other columns, so id like it to be
>
> 14``value``value2``value3
$new = preg_replace ('/`
It's a lame way, but it works,
I sure hope that someone can tell me how to do it in pure regexp.
like how can i 'search for next occurence' in ereg or any regexp() in PHP
-
";
echo "matched: $match\n";
}
?>
-
""David Balatero"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[E
On Thursday 08 March 2001 09:19, you wrote:
> I'm putting together a regex to pull all of the urls out of a web page.
> Not the href tag, but just the url part of that tag.
>
> Here's what I've come up with:
>
> preg_match_all('/<.*href\s*=\s*(\"|\')?(.*?)(\s|\"|\'|>)/i', $html,
> $matches);
> for
Try the perl compatible one, you can set a limit of how many times to
replace:
http://www.php.net/manual/en/function.preg-replace.php
> I've tried and tried to no avail, can someone assist
> I need to select the first space in a line like the following
> Nelson Bob and Mary, 123 Street st., Ash
From: "Jerry Lake" <[EMAIL PROTECTED]>
> I've tried and tried to no avail, can someone assist
> I need to select the first space in a line like the following
> Nelson Bob and Mary, 123 Street st., Ashton, 555-1212
>
> I need to replace the space between Nelson and Bob with
> a comma so I can sep
On Friday 23 February 2001 19:33, John Vanderbeck wrote:
> I need to take a string and remove everything from the first "<"
> character to the end of the line. I'm pretty sure I could do this with
> an ereg_replace(), but I am horrible at regular expressions. Could
> anyone help me with this?
You should either do this with ereg, or strtolower and not a combination of
the two, and in all actuality strtolower is specifically desinged to do this
very easily so I would go with it.
";
$contents = strtolower($contents);
?>
Should do what you want.
--
phill
"Ian LeBlanc" <[EMAIL PROTECTED
Hi Christian,
>$html_code = eregi_replace (..., $html_code);
arghhh ... I'm so stupid !! Yes, u're right ...
really, many thanks
max
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the
On Sunday 18 February 2001 19:54, n e t b r a i n wrote:
> >> function change_sess(&$html_code){
> >>if(eregi("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",$html_code)){
> >>
> >> str_replace("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}"," >>l() ;?>", $html_code);
> >
> >str_replace doesn't know ab
did you check the value *before* writing it to a file?
before trying to solve any problem, you have to know
where to look perhaps the problem lies with the file
instead of the regexp.
the following code worked great for me:
Lnk';
$html = preg_replace('/&flag=(\d{9})&PHPSESSID=(\w{32})/', ap
Hi Christian,
>> function change_sess(&$html_code){
>> if(eregi("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",$html_code)){
>>
>> str_replace("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",">;?>", $html_code);
>str_replace doesn't know about regular expressions, so it tries to find
>the literal st
On Saturday 17 February 2001 21:49, n e t b r a i n wrote:
> function change_sess(&$html_code){
> if(eregi("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",$html_code)){
>
> str_replace("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",";?>", $html_code);
str_replace doesn't know about regular expressio
On Thursday 15 February 2001 22:43, Jerry Lake wrote:
> is there a way I can make a regex to add a comma
> to the beginning of every line of a comma delimited
> file ?
$NewContent = preg_replace ('/^(.)/m', ',\\1', $OldContent);
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Wh
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Jesse Swensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 4:39 AM
To: PHPBeginner.com
Subject: Re: [PHP] Regex help needed...
on 2/12/01 4:30 PM, Christian Reiniger at [EMAIL PROTECTED] wrote:
> On Monday 12 February 2001 21:08, Jesse Swensen wrote:
This should be a quick one, but I can't seem to wrap my brain around
it. All I need to do is replace leading or trailing spaces with
underscores. If there is
On Monday 12 February 2001 21:08, Jesse Swensen wrote:
> >> This should be a quick one, but I can't seem to wrap my brain around
> >> it. All I need to do is replace leading or trailing spaces with
> >> underscores. If there is spaces in between words, leave them alone.
> but I wanted to convert
> This is very close. If the string, " Testing ", had multiple spaces, but
> I wanted to convert each space to a "_", then what? I tried:
There may be a better way, but here is a lengthy one that works.
$checkme = " this is it ";
if(ereg("^( )+", $checkme
on 2/12/01 1:01 PM, Jason Stechschulte at [EMAIL PROTECTED] wrote:
> On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote:
>> This should be a quick one, but I can't seem to wrap my brain around it.
>> All I need to do is replace leading or trailing spaces with underscores. If
>> there
rtrim()
www.php.net/rtrim
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Jesse Swensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 2:15 AM
To: [EMAIL PROTECT
On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote:
> This should be a quick one, but I can't seem to wrap my brain around it.
> All I need to do is replace leading or trailing spaces with underscores. If
> there is spaces in between words, leave them alone.
$fix = ereg_replace("(^ )|
On Sunday 11 February 2001 17:21, akio wrote:
> $thestring = "\"Hello everyone\" bye";
>
> What I want to extract is: Hello everyone. Instead I get: bye.
> I use this command
>
> ereg("([^\"\"]*)$",$thestring,$regs)
>
> and echo $regs[1].
>
> How can I extract what's within double quotes?
Hmm,
In article <059301c08981$7859a020$[EMAIL PROTECTED]>, "Remco
Chang" <[EMAIL PROTECTED]> wrote:
You need to find the ASCII codes for these characters and
include them in the range of acceptable chars in the ereg.
something like:
[\xc0-\xff]
where this represents a range of ASCII codes in octal
Thomas,
Not sure if this si what you want but it may start you in the right
direction.
";
preg_match_all( '/\S*\s?=\s?\S+[^>]/', $bob, $match );
foreach ($match[0] as $match_result) {
echo $match_result."";
}
?>
Robert W. Collins
Web Developer II
Insight / TC Computers
www.insigh
> 123 4567
> 1234567
> +91 44 123 4567
> +91 44 1234567
> 91-44-123 4567
> 91-44-1234567
So, 91441234567 and 9 1 4 4 1 2 3 4 5 6 7 aren't valid?
You *could* apply a rule here, but it's fallible.
1. Strip out everything thats not a number (ereg_replace("[^0-9]", "")).
2. Count the number of dig
Thanks for the reply.
I'd like to ensure that numbers entered are in any of these formats:
123 4567
1234567
+91 44 123 4567
+91 44 1234567
91-44-123 4567
91-44-1234567
Number will be a minimum of 5 digits.
TIA
Vikram
At 12:11 AM 1/16/01 +1100, Angus Mann wrote:
>At 17:55 15/01/01 +0500, Vikr
> Can someone help me out with a regex to validate a phone number?
That's a tough one, because 555- is just as valid as 1-800-BILLME.
And here in Australia we have 131166 (yes, all you Aussies, that *IS*
Pizza Hut's number... I couldn't think of any others :))
The best you can really do is m
case "phone_us":
if(ereg("^([2-9][0-9]{2})([2-9][0-9]{2})([0-9]{4})$", $var)){
return TRUE;
}else{
set_stringtypes_error(throw_error3("lib_string_types_108", $var));
}
break;
case "phone_int":
if(!preg_match("/[^0-9\(\)\-\. ]/", $var)){
return TRUE;
}else{
se
Hi!
> Can someone help me out with a regex to validate a phone number?
Read the examples at:
http://www.php.net/manual/en/function.ereg-replace.php
Der Heiko
Buchtipp: http://www.aufbruch.com/
Heiko und Gisela Spallek:
Aufbruch ins Land der unbegrenzten Moeglichkeiten.
Studieren, Arbeiten und L
At 17:55 15/01/01 +0500, Vikram Vaswani wrote:
>Hi!
>
>Can someone help me out with a regex to validate a phone number?
We'd need to know what format of telephone numbers you're looking to
validate, first.
Angus.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAI
First, the ()'s in the split regex makes no sense. Split has no registers
to save stuff to.
Second, that is a rather clunky way to loop through an array.
Third, since the regex in split defines the delimiter to use to split the
string on, the actual "1 -->" part of the data is gone. Why are yo
;([[:alpha:]]+) ", "\\1".",", $test);
>>that works to an extent, except that it adds the comma after
>>every word that is followed by one space and not just the first occurance
>>
>>Jerry Lake
>>
>>-Original Message-
>>From
ot;([[:alpha:]]+) ", "\\1".",", $test);
>that works to an extent, except that it adds the comma after
>every word that is followed by one space and not just the first occurance
>
>Jerry Lake
>
>-Original Message-
>From: Cynic [mailto:[EMAIL PR
pt that it adds the comma after
every word that is followed by one space and not just the first occurance
Jerry Lake
-Original Message-
From: Cynic [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 12, 2001 3:41 PM
To: Jerry Lake; [EMAIL PROTECTED]
Subject: RE: [PHP] regex
looks like yo
>>and how would I go about that?
>>
>>Jerry Lake
>>
>>-Original Message-
>>From: Cynic [mailto:[EMAIL PROTECTED]]
>>Sent: Friday, January 12, 2001 3:10 PM
bout
3500 records and I'd hate to have to do it by hand
any ideas?
Jerry Lake- [EMAIL PROTECTED]
-Original Message-
From: Cynic [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 12, 2001 3:25 PM
To: Jerry Lake; [EMAIL PROTECTED]
Subject: RE: [PHP] regex
depends. is the set o
At 02:54 PM 1/12/01 , Jerry Lake wrote:
>is it possible with regex to
>change one or more text characters
>followed by a space into the same
>characters followed by a tab?
>
>Jerry Lake
For example -
$NewString = ereg_replace("([[:alpha:]]+) ", "\\1".chr(9), $String);
This will conver
t;-Original Message-
>From: Cynic [mailto:[EMAIL PROTECTED]]
>Sent: Friday, January 12, 2001 3:10 PM
>To: Jerry Lake; [EMAIL PROTECTED]
>Subject: Re: [PHP] regex
>
>
>yes
>
>At 23:54 12.1. 2001, Jerry Lake wrote the following:
>---
and how would I go about that?
Jerry Lake
-Original Message-
From: Cynic [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 12, 2001 3:10 PM
To: Jerry Lake; [EMAIL PROTECTED]
Subject: Re: [PHP] regex
yes
At 23:54 12.1. 2001, Jerry Lake wrote the following
yes
At 23:54 12.1. 2001, Jerry Lake wrote the following:
--
>is it possible with regex to
>change one or more text characters
>followed by a space into the same
>characters followed by a tab?
>
>Jerry Lake
>
>
>--
>PHP General Mailing
501 - 578 of 578 matches
Mail list logo