At 01:50 PM 3/25/2005, you wrote:
Ok. I am really bad at regular expressions. I have to search through
some files and put the contents into an array. A file could look like this:
$aliases=`cat /home/virtual/site$site_id/fst/etc/mail/local-host-names`;
start of file
# local-host-names -
Steve Buehler mailto:[EMAIL PROTECTED]
on Friday, March 25, 2005 11:50 AM said:
It would also be fine to just do a loop that checks each line.
Since I guess that would be quicker. If the line starts with
a #, then ignore it, otherwise, do some other stuff.
Yeah do this. You don't need a
I wouldnt recommend using a regular expression for this. Regular
expressions most of the time are now the answer. You could just do
something like:
foreach ($line as file('/home/virtual/')) {
if (substr(trim($line), 0, 1) == '#') {
//$line is a comment
} else {
on one place I have string something (something_2)
I have to take out of the string everything in brackets and brackets as
well.
probably I will need to use Regular Expression Functions but I'm really
bad with them :)
$string = something (something_2);
$pattern = /\(.*\)/;
$replacement = ;
That was fast! :)
Thanks Matt
-afan
Matt M. wrote:
on one place I have string something (something_2)
I have to take out of the string everything in brackets and brackets as
well.
probably I will need to use Regular Expression Functions but I'm really
bad with them :)
$string = something
Matt M. wrote:
on one place I have string something (something_2)
I have to take out of the string everything in brackets and brackets as
well.
probably I will need to use Regular Expression Functions but I'm really
bad with them :)
$string = something (something_2);
$pattern = /\(.*\)/;
In my case it will be actually product name (product number) and
always the same. That means Matt's code will do exactly what I need.
But, thanks for your post - could happen to use that on other place
:)
Thanks John
-afan
John Holmes wrote:
Matt M. wrote:
on one place I have string something
Try putting a ? after your quantifier for non-greedy matching.
Something like: $the_array=split(A (.*?)/A, $html,-1);
Matt.
- Original Message -
From: brendan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 29, 2001 7:55 PM
Subject: [PHP] @#$@# Reg Expressions
love
what something like: $the_array=split(A ([^]*)/A, $html,-1); ??
so, everything that's not a
-Original Message-
From: brendan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 1:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP] @#$@# Reg Expressions
thanks but it didnt work either
ok, are you trying to get the links returned or just split on them? i missed
your original post.
watch your caps as well...
i'd use preg_split also
jack
-Original Message-
From: brendan [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 9:59 PM
To: [EMAIL PROTECTED]
Subject:
martin, jack ..
cheers for the replies
Jack.. I am trying to strip out all links in the page that is between
the a href and /a
I was using
$html =GETSITE($url);
$the_array=spliti(A (.*)/A, $html,-1); //spliti to avoid any case
sensitivity.
foreach($the_array AS $k) echo $k.HR;
I had given
brendan, please clarify: you're trying to strip out all links in the page
that is between
the a href and /a
you're trying to strip out all links and return them?
if so, split won't work.it splits on whatever the pattern is.
if you're trying to get all the links, you could do [this
]
Subject: RE: [PHP] @#$@# Reg Expressions
brendan, please clarify: you're trying to strip out all links in the page
that is between
the a href and /a
you're trying to strip out all links and return them?
if so, split won't work.it splits on whatever the pattern is.
if you're trying to get all
30, 2001 2:30 PM
To: brendan; [EMAIL PROTECTED]
Subject: RE: [PHP] @#$@# Reg Expressions
brendan, please clarify: you're trying to strip out all links in the page
that is between
the a href and /a
you're trying to strip out all links and return them?
if so, split won't work.it splits
On Tue, 30 Oct 2001 14:47, brendan wrote:
mate you rock..
You can tell he's an Australian (on ya mate :-)
--
Brad Hubbard
Congo Systems
1/286 Bolton Street, Eltham
Victoria, Australia, 3095.
Email: [EMAIL PROTECTED]
Ph: +61-3-94391200
Fax: +61-3-94391255
Mob: +61-419107559
--
PHP General
Off track - seems like the only ppl awake now are ozzies :)
would I be right?
-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions
On Tue, 30 Oct 2001 14:47, brendan wrote
or really bloody narky afgani's
Martin Towell wrote:
Off track - seems like the only ppl awake now are ozzies :)
would I be right?
-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP
or the east coast.only 11:35 here in dc
-Original Message-
From: brendan [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 11:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions
or really bloody narky afgani's
Martin Towell wrote:
Off track - seems like
]]
Sent: Tuesday, October 30, 2001 3:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions
On Tue, 30 Oct 2001 14:47, brendan wrote:
mate you rock..
You can tell he's an Australian (on ya mate :-)
--
Brad Hubbard
Congo Systems
1/286 Bolton Street, Eltham
Victoria, Australia, 3095
On Tue, 30 Oct 2001 15:14, brendan wrote:
or really bloody narky afgani's
Martin Towell wrote:
Off track - seems like the only ppl awake now are ozzies :)
would I be right?
No jokes about Tamanians or New South Welshmen though alright?
--
PHP General Mailing List (http://www.php.net/)
Your too late for that ..
recipie boy (aka speedboy) already had a go at us southerners
I reckon you noreasterners are for it next ..
Im working on finding out where he's from so we can make fun of his state ..
Im working hard..
ill find out..
then the jokes'll be flying..
;)
Brad Hubbard
On Tue, 30 Oct 2001 15:27, brendan wrote:
Your too late for that ..
recipie boy (aka speedboy) already had a go at us southerners
I reckon you noreasterners are for it next ..
Im working on finding out where he's from so we can make fun of his state
.. Im working hard..
ill find out..
Here - I'm from NSW, Oz !!! can't make it any harder for you :)
-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:42 PM
To: brendan; [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions
On Tue, 30 Oct 2001 15:27, brendan wrote
On Tue, 30 Oct 2001 15:49, Martin Towell wrote:
Here - I'm from NSW, Oz !!! can't make it any harder for you :)
And how are things in York St.?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To
On Tue, 30 Oct 2001 14:51, Martin Towell wrote:
Off track - seems like the only ppl awake now are ozzies :)
would I be right?
-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg
ARGH!! You, you, missed!! :/
-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:53 PM
To: Martin Towell; [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions
On Tue, 30 Oct 2001 15:49, Martin Towell wrote:
Here - I'm from NSW, Oz
hans up who else is procrastinating?
;)
Martin Towell wrote:
ARGH!! You, you, missed!! :/
-Original Message-
From: Brad Hubbard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 3:53 PM
To: Martin Towell; [EMAIL PROTECTED]
Subject: Re: [PHP] @#$@# Reg Expressions
On Tue, 30 Oct 2001 15:53, brendan wrote:
hans up who else is procrastinating?
;)
My productivity was suckin' pretty badly before all this started anyway.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
28 matches
Mail list logo