| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10
Comments:
<0> er.. i mean... <1> Two-Bits, you been a good help in like, 3 different channels today. <1> Thanks <0> oh hey, look at the time. time for a drink! everybody /clear their screens and we'll start over <0> Moridin: yeah, i'm way behind in my drinking. christ it's 11pm. i shoulda started like 12 hours ago when i woke up <1> Today's my first real day of coding, and so far, I got what I needed done to translate a buttload of data into mysql, and search that data and have it displayed in a table in php. <0> congrats <2> http://newyork.craigslist.org/mnh/fee/163997572.html <2> i want. <1> I just started learning php and mysql yesterday, so I feel I've come a bit of a ways <2> all i have to do is make basically 2.5x what i make now and i'll be able to afford that <0> as long as you understand everything you've written <1> Aye, I've been trying to <1> It seems every new thing I do, I break several times before I figure it out <3> such is the way of the world. <4> uh
<4> anyone good wif regexes care to give me hand? <5> ask poutine <3> i am. <5> pm him <4> destination bl_warez { domainlist blacklists/warez/domains urllist blacklists/warez/urls } If i want to match <4> destination and everything in the { } <3> but im' only good with regexes, i don't know about wif <4> what would I use? <4> pizza_milkshake: I made a typo <4> Pardon Moi <6> /(^[^ ]) .*?\{(.+?)\}/ <3> @php preg_match('/\{(.*?)\}/', "bob { a/b/c }", $m) && echo $m[1]); <7> PHP Parse error: syntax error, unexpected T_ECHO <3> @php preg_match('/\{(.*?)\}/', "bob { a/b/c }", $m) && print($m[1]); <7> Result: a/b/c <4> lol <4> that matched nothing for me <4> would destination[\w+{[\s\w\/]+} work ? <4> or (destination[\w+{[\s\w\/]+}) <3> DjK4ye: what regex function are you using? <4> preg_match <3> no, yours are all ****ed up <4> I figured but I don't know any better tho <3> mine will work <8> DjK4ye: http://www.phpguru.org/downloads/PCRE%20Cheat%20Sheet/PHP%20PCRE%20Cheat%20Sheet.pdf <8> g'nite <4> {(.*?)} would be what I'm searchin for right? <4> what if I want the desination in front of it as well <3> no. <3> read mine <4> http://osteele.com/tools/rework/ <4> I'm using this to test the regexes <3> {} are special, they must be escaped to match a literal <4> ah ok <4> last question then <4> If I wanted the destination in front of it <4> how would I do that <6> @php $string = 'destination bl_warez { domainlist blacklists/warez/domains urllist blacklists/warez/urls }'; if(!preg_match('/(^[^ ]+) .*?\{(.+?)\}/', $string, $matches)) die("**** you"); echo implode(' | ', $matches); <7> Result: destination bl_warez { domainlist blacklists/warez/domains urllist blacklists/warez/urls } | destination | domainlist blacklists/warez/domains urllist blacklists/warez/urls <0> \S > [^ ] <6> sure <4> Hmm <4> works fine efor that line <0> and the space before .*? is unnecessary <9> oops <4> but if its a larger file? <0> DjK4ye: if the body of { } spans multiple lines, you'll want the /s modifier <0> plz 2 DOTALL <6> yeah <4> ah okay <0> it wont handle nesting too well either <4> http://eschooldev.perridot.my/cl***dev/dCl***.php <4> http://eschooldev.perridot.com/cl***dev/dCl***.php <4> srry wrong 1 <4> I don't need nesting <4> I just need to retrieve bits n portions outta the config file for me to edit <4> and later put back in <0> wait.. did you need the word destination? or the word after it? <4> I needed desitnation
<4> the other word is a variable <4> destination* <0> mkay <1> $var++ is the same as $var = $var +1 right? <4> Moridin: yep <1> coo <6> and is also the same as <6> $var += 1; <1> So if I wanted to raise $var by 2 per iteration of a loop, I'd $var += 2; <6> yep <4> Any ideas on that regex? <1> I'm so lost on where I'm going with this loop, but I'll get there eventually. <0> DjK4ye: i thought you were good? <0> Moridin: you're going in circles, that's the problem <1> I'm uh, sticking a loop within a loop to run queries based on information called from a query >.> <10> Two-Bits: I wish i was <11> loopy loopy <10> http://eschooldev.perridot.my/cl***dev/dCl***.php <10> Take a look at what it matches below <0> Moridin: sounds straight forward... <1> It does <1> But I'm still a bit lost on where I'm going with it still. <0> STupidDisconnects: ahhh, hrm <1> I know the SQL query to get the data, I know the php to run the query, but I'm still lost on how to put it together so it outputs the way I want. <1> I'm sure if I stare at it long enough, it'll click. <0> does the file actually have those <br />'s ? <10> nope <10> it has \n <0> \n or \r\n ? <10> I'm using nl2br() <10> just \n <0> mkay <10> Is it possible to just get the destination SOMETHING { SOMETHING } ? <0> i asked if you wanted that SOMETHING already <10> what i want is the entire thingy <10> but nothing else <10> like if i have 5 destination SOMETHING { SOMETHING } s ... <10> It should return an array with 5 of those <10> I don't know I'm making myself clear =.=' <0> oh.. so you DONT'T need it in pieces <10> I prolly will later, but right now I just wanna retrieve the entire thing.. <0> ok, this outta work <0> /\n([\w-]+\s+[\w-]+\s+\{.+?\})/ <0> i left the 2 words available for matching latter if it helps <0> otherwise i actually think /\n.*?\{.*?\})/ would suffice considering how the non-greedy's SHOULD work <0> er <0> /\n(.*?\{.*?\})/ <0> is that supposed to get the lines that DONT start with 'destination'? <12> Err.. <12> lol <0> if so it just needs to go litereally into the pattern <12> weird <0> /\n(destination .*?\{.*?\})/ <0> preg_match_all if you want more <12> thanks man <12> You're a life saver <0> no, i'm a skittles <0> taste my rainbow <1> What does a return of Resource id #whatever mean? <13> ... <0> Moridin: resource types are usually p***ed to other related functions to get useful information <1> It should be return from my sql query <0> usually it's to keep resources down by keeping relavent data in a lower level language or in this case, on the db server, until requested <14> I am a Jesus Fish <0> mysql_query returns a resource id or FALSE <14> Trapped in a Darwin Fish body. :( <2> @php 20 / 12 <0> that result resource id is to be used with the mysql_fetch_* functions to actually get rows of data from the query <0> look at the examples <2> er <0> evulish: echo <1> Oh.
Return to
#php or Go to some related
logs:
freezies + lsd irc israelpass yamakasi 2 inndir sky balloon in india #linux #chat-world #kl netcafe shots rawalpindi #india #allnitecafe
|
|