Page 2 of 2

Posted: Sat Apr 23, 2005 9:25 am
by Chris Corbyn
I have just lifted the HTML source from their site and then...

Code: Select all

<?php

$string = '<tr><td class="yfnc_tablehead1" width="48%">Last Trade:</td><td class="yfnc_tabledata1"><big><b>568.50 p</b></big></td></tr>';

preg_match('#<tr><td class="yfnc_tablehead1" width="48\%">Last Trade:</td><td class="yfnc_tabledata1"><big><b>(\d+\.\d{2}) p</b></big></td></tr>#s', $string, $matches);

echo $matches[1];

?>
Try it.... then take another look at your code.

Posted: Sat Apr 23, 2005 9:40 am
by mjseaden
Hi, that works. Thanks for all the help.

Mark

Posted: Sat Apr 23, 2005 12:17 pm
by m3rajk
mark-

i personally think they shouldnt have given you the answer.
there is a difference between trying and needing pointers asnd asking others to write.

what i see her is asking others to write... like a script kiddie. there is no evidence of trial

i mentioned before i understand that regexp is not an easything to learn, but it's not rocket science either.


go get a good regexp book

also search on here


searches on here done just now.....


'regexp' Search found 168 matches
'regular expressions' Search found 950 matches

http://www.google.com/search?hl=en&q=bo ... gle+Search

next time search and look and tell us how you're thinking about it. break down the code. here's an example:


$variable=preg_match($input, $regexp);

the input is a line of code
i'm looking for numbers 0 to 9 in order

this is what i came up with
$regexp='/[0-9]/';

this is matching anything with a number, not 0 to 9 in order. could you help?



in that we see that you know what the input should be. you know what you're looking for. you also show us what you have and we can see why. we can realize a bit about your pattern matching. we can point you in the right direction so that you learn.

instead, what you give is the equivalent of "i have thos line [some php line] and it's not working. somone make it find xyz for me"


do you see why people are telling you tofind a book? if you've been doing this for a while, i'm suprised the mods are putting up with you. why? you were obviously rude to feyd at some point. i've never seen him post like that before this thread. he's always been one fo the most understanding and helpful people on this site. for him to be <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> at you, you've been asking a lot and showing no signs at all of learning.... and probalby none for caring to learn

Posted: Sat Apr 23, 2005 4:26 pm
by mjseaden
m3

I see what you mean about learning, but at the same time, I don't recall ever being rude to Feyd. Feyd, have I ever been rude to you?

I've posted a lot of messages here, and most have been non-simple premises that I've found it difficult to solve any other way - for example the more subtle error messages that could mean more than one thing, or header problems.

There are times when I'm searching for instant gratification more than others, but then again a a lot of the time I'm not. When I am, it's more often the case because I've got a more pushing deadline than others. In this case, it's difficult to get out a book and study; and because Google does not herald all answers (it doesn't), the next best thing I can do is go to this forum and ask. But there's an instance on here where the gap between problem and solution has been very small. And on top of that, I find that a lot of people enjoy contributing on this forum and/or learn themselves from the experience.

I also find, on all forums including this one, a lot of people who seem to take things very seriously, and will be the first to point out rules of some kind that you 'so obviously missed', or want to feel like they're some sort of (imagined) 'collective voice' and speak for the 'forum' on something. Forums do seem to produce that cognitive distortion.

The thing with all forums, on whatever topic, is that if you don't want to contribute, don't. You also find, because this is the internet and not a personal interaction, people who do not usually feel comforable speaking their minds will usually find forums an ideal platform to do this - trolls are a classic example of this, viewing the forum users as a 'fake' 'computer generated' 'impersonal' responder who is not really real (go lookup troll psychology).

More often than not, whether there's a short gap between stimulus and gratification, forums are usually the best port of call whatever problem there is to solve, and this particular forum usually seems to be the best place to do that.

The reason why I have so many posts here is because it is my personal policy never be rude to contributors - and if I have, I'd be happy top to apologise for it - only it's just that I can't think of when I have.

So if I've been rude, I'd be happy to listen to your point of view.

Cheers

Mark
Regular contributor to this forum

Posted: Sat Apr 23, 2005 7:08 pm
by Chris Corbyn
m3rajk, I have to agree with mjseaden here regarding a few points.

I have never seen mjseaden be rude to any member of this forum and that is not the reason that feyd asked mjseaden to try and learn this. feyd was not unwilling to help... what he was unwilling to do was simply write the regex for mjseaden.

mjseaden also has a valid point regarding making a contribution and allowing others to learn from one's problems. You do have to try and learn this though. If you sat down for just one hour and went through some tutorials:

http://www.regular-expressions.info is a reasonable beginners resource

You'd at the very least learn the basic principles and we could take it from there.

OK lets just keep the thread on-topic and aviod venting our anger in here.