IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1982.48 MB
Powered by
Channel Info
Network: freenodeChannel: #php |
Search in www.irclog.org
Log from #php at freenode 2006-06-29
[01:57]<tml>+yeah
[01:57]<wjlllrws>+PHP IS MySQL? Since when?
[01:57]<tml>+send me an email
[01:57]<xrwcrfjjryn>+narutofan, php is php, sql is sql, mysql uses sql. this is not rocket surgery
[01:57]<wjlllrws>+TML: Will do
[01:57]<zgmznacw>+TML: It mateches the <set... /> tag and then I extract the information and do useful stuff with it, and after I do the useful stuff, I remove it.
[01:57]<zgmznacw>+*mactches
[01:57]<zgmznacw>+*matches
[01:57]<zgmznacw>+Jeez.
[01:57]<tml>+andrejkw: The only difference between your code and mine is that I don't check to see if the expression matched. Instead, I just apply the replace, because if it doesn't match, it simply won't replace anything.
[01:58]<zgmznacw>+TML: I understand, but I actually want/need the information matched.
[01:58]<zgmznacw>+TM: I am planning on using it.
[01:58]<wjlllrws>+TML: to @php.net will be good or @yourhost?
[01:58]<tml>+andrejkw: So do the match first, and then do the replace.
[01:58]<tml>+Wolfpaws: @gmail
[01:58]<ajyf>-TML, thats a good question and i think the answer is that I'm a php newb and didnt think of that option
[01:58]<zgmznacw>+TML: That's what I've been doing, no?
[01:59]<wjlllrws>+TML: I don't have your gmail address...
[01:59]<tml>+andrejkw: No.
[01:59]<zgmznacw>+TML: hmm...
[01:59]<zgmznacw>+TML: Oh, I see what you mean.
[01:59]<zgmznacw>+TML: Let me try ;)
[02:00]<tml>+andrejkw: You added some extra stuff into the preg_replace() inside the if(). My suggestion is to use the same expression for replacement as you did for matching.
[02:00]<tml>+Because that's how you're thinking of the data anyways.
[02:01]<xnzns>-dammmm zend studio fucks eveytime a try to run my code inside it :(
[02:01]<tml>+heres: Watch you language.
[02:01]<tml>+s/you/your/
[02:01]<zgmznacw>+TML: I am having the same problem.
[02:01]<xnzns>-TML, sorry
[02:01]<tml>+In fact, you could do: $expr = "|<set\s*.....whatever"; preg_match($expr, $test); preg_replace($expr, "", $test);
[02:01]<tml>+andrejkw: No, you're not, unless you didn't actually follow my suggestion.
[02:01]<zgmznacw>+TML: Now I get two blank lines.
[02:02]<tml>+andrejkw: Repalce your preg_replace() with my preg_replace()
[02:02]<tml>+s/pal/pla/
[02:02]<zgmznacw>+Ok.
[02:02]<zgmznacw>+TML: Will your preg_replace work even if two if's are on the same line?
[02:02]<zgmznacw>+TML: Because that \n at the end scares me.
[02:03]<tml>+andrejkw: I'm using *YOUR* expression
[02:03]<tml>+I copied the preg_match_all() expression verbatim
[02:03]<zgmznacw>+TML: Oh ok.
[02:03]<zgmznacw>+TML: Well now I get *BLANK LINE*Hello 2*BLANK LINE*Hello 1.
[02:03]<tml>+Oh, no, you're right, I made a change.
[02:04]<tml>+Personally, I'm wondering what moron created this markup language you're using.
[02:04]<tml>+Textnodes should be in containers.
[02:04]<zgmznacw>+What do you mean?
[02:05]<zgmznacw>+A friend actually helped me construct the expression, but now he doesn't know what to do anymore.
[02:05]<zgmznacw>+And I am having problems with it.
[02:05]<wjlllrws>+andrejkw: Quotes, pipes, tags,...
[02:05]<zgmznacw>+Ah ok.
[02:05]<zgmznacw>+What's wrong with it?
[02:06]<tml>+andrejkw: I mean that textnodes should be in containers
[02:06]<tml>+Given "<if> foo", foo bears no relationship to <if>
[02:06]<tml>+Given "<if>foo</if>", foo is *CLEARLY* contained in <if>
[02:07]<zgmznacw>+Ah lol.
[02:07]<tml>+Right now, your "Hello"s are just floating in markup limbo
[02:07]<wjlllrws>+XML has that problem solved in pretty sane way
[02:08]<tml>+Now, if there's a parent, say <foo><set var="lol" eq="hello" />Hello 2<set var="lol" eq="hello" />Hello</foo>, you could just ask for all the textnodes of <foo>
[02:08]<zgmznacw>+Well, but it doesn't work like that... It's just <if... />
[02:08]<zgmznacw>+:\
[02:09]<zgmznacw>+I understand what you mean though.
[02:09]<tml>+ "//foo::text()"
[02:09]<zgmznacw>+Huh?
[02:10]<tml>+andrejkw: "//foo::text()" is how you ask XSLT for all "Hello 2" and "Hello" without getting the <set>s
[02:10]<tml>+Given <foo>...your stuff</foo>
[02:11]<zgmznacw>+Ok, I have no clue what XSLT is...
[02:11]<tml>+Clearly
[02:11]<wjlllrws>+php.net/xslt
[02:11]<zgmznacw>+But, what if I want to fix the current problem I am having...?
[02:12]<wjlllrws>+andrejkw: Wy don't you use languages, that are already written just for the purpose you're doing?
[02:13]<tml>+andrejkw: You're trying to use markup-y languages without understanding them. First, get wisdom enough to know you need to stand on the shoulders of the giants who have come before you; "and with all thy getting get understanding".
[02:13]<zgmznacw>+My server doesn't have PHP with --enable-xslt.
[02:13]<zgmznacw>+:\
[02:13]<tml>+Then you won't HAVE the problem you're having.
[02:14]<mzzcl>+andrejkw: Are we still on that regex thingy?
[02:14]<zgmznacw>+So it's impossible to do the way I am trying to do it?
[02:14]<tml>+No
[02:14]<mzzcl>+No, you can do it
[02:14]<xrwcrfjjryn>+not impossible, just very very stupid
[02:14]<tml>+It's impossible to day it in a way that is at all maintainable, or makes sense to anyone in the world except you.
[02:14]<mzzcl>+andrejkw: Just remove the \s* off the from of the preg_replace ..leave it on the end
[02:15]<mzzcl>+preg_replace( "|". preg_quote( $match[0] ) ."\s*|is"
[02:15]<mzzcl>+The first \s* is causing the prob
[02:15]<tml>+ACTION points out to MarkL that we're trying to move AWAY from the preg_quote(). :)
[02:15]<mzzcl>+TML: Oh, I just wondered back in ;)
[02:15]<zgmznacw>+Wow
[02:15]<zgmznacw>+YOu're a genius.
[02:15]<zgmznacw>+O.O
[02:15]<zgmznacw>+It worked right away
[02:16]<wjlllrws>+ACTION shudders
[02:16]<mzzcl>+It was removing all chars backwards due to the is ... the s doesn't ignore newlines
[02:16]<zgmznacw>+Thank you very much :)
[02:16]<zgmznacw>+That's all I needed all along :P
[02:17]<tml>+I'd argue you still need to fix your markup
[02:17]<wjlllrws>+ACTION believes this isn't going to end well
[02:17]<tml>+But clearly that's not going anywhere, and I just remembered: It's YOUR grave, not mine.
[02:17]<wjlllrws>+*nod*
[02:18]<mzzcl>+But look on the bright side .. it's done now ;)
[02:18]<zgmznacw>+But like I said my server has no XSLT support...
[02:18]<zgmznacw>+Unless there is another way...







