@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29



Comments:

<0> pravus: see my point :-p
<1> rutski89: so username should only contain [a-z0-9] ?
<0> pravus: yea
<0> pravus: oh, I think you missed the /i at the end too
<1> rutski89: so: $username =~ /^[a-z0-9]+$/i; ?
<0> speaking of which, is eq case sensitive, or insensitive?
<2> sensitive. It asks if the strings are exactly equal.
<0> beth: is there an insensitive form?
<0> pravus: yea, that's better
<0> pravus: ty
<1> beth: with double negation? *urk*
<3> rutski89: $x =~ m/string/i
<2> rutski89: not as a builtin, no. You could use a regex or whatever.
<0> beth: yea
<2> pravus: yeah, actually. It's just looking for one non-allowable character, and then rejecting it



<0> pravus: for some reason I think the double negation was required, but if forget why; let me think about that for a sec
<4> Anyone about that can help me with PoCo State?
<2> die "you ****" unless /[^a-z0-9]/i
<1> beth: i just try to avoid those things... like: unless(!$foo) { ... }
<2> well, consider the above rephrasing. Very clear.
<0> pravus: ahh, nm; your adding of the ^ and $ make the double negation unecesary
<0> **unnecessary
<1> yeah, without anchors it wouldn't work quite the same
<0> beth: hmm... yea; yours looks good too
<0> pravus: yup
<1> rutski89: you may also want \z instead of $ since $ matches before \n as well
<0> pravus: how do you mean?
<0> what's \z?
<1> rutski89: \z matches the absolute end-of-string
<2> pravus: that's news to me, where is it documented?
<0> oh, you mean that even with the anchors, a sneaky user might put a \n at the end of his username?
<1> beth: perldoc perlre ?
<5> beth: Type 'perldoc perlre' in your shell or go to http://perldoc.perl.org/perlre.html
<1> i think that's where i read about it :)
<0> yea, it's there; i'm reading it now
<2> pravus: I'm not seeing it in there; that's why I ask
<1> \z Match only at end of string
<0> beth: it's there, in the 'Perl defines the following zero-width ***ertions:' section
<1> it's in there</ragu>
<2> ahh ok
<1> beth: i have *never* used it myself... yet
<0> pravus: was I right about what i said before though
<0> pravus: that with $ as the zero-width ***ertion a sneaky user might put a "\n
<0> at the end of his username
<1> rutski89: yes, that would be possible
<0> pravus: cool, so the final verdict is
<0> /^[a-z0-9]+\z/i
<1> eval: $_="ab\n"; if(/^ab$/) { $x="Match" } else { $x="No Match" }; $x
<5> pravus: Match
<0> cool
<0> eval: $_="ab\n"; if(/^ab\z/) { $x="Match" } else { $x="No Match" }; $x
<5> rutski89: No Match
<1> eval: $_="ab\n"; if(/^ab\z/) { $x="Match" } else { $x="No Match" }; $x
<5> pravus: No Match
<0> wow, did we do that at the exact same second
<0> **microsecond
<0> oh... wait a sec
<0> eval: $_="ab\n"; if(/^[a-z0-9]$/i) { $x="Match" } else { $x="No Match" }; $x
<5> rutski89: No Match
<0> pravus: $ works just as well as \z in this case :)
<0> eval: $_="ab\n"; if(/^[a-z0-9]+$/i) { $x="Match" } else { $x="No Match" }; $x
<5> rutski89: Match
<2> your regex is asking for one character.
<0> oh, no it doesn't
<0> beth: yea, it was a type-o
<0> eval: $_="ab\n"; if(/^[a-z0-9]+/i) { $x="Match" } else { $x="No Match" }; $x
<5> rutski89: Match
<1> $ will match before a \n
<0> yea
<0> the reason i'm trying to get rid of the \z is because I'm not sure if PostgreSQL supports it
<0> this regexp is for a table constraint
<1> what does postgresql use for regex?
<1> surely just normal regex, right ?
<1> in which case $ would match absolute end-of-string
<0> pravus: so $ not matching absolute end-of-string is a behavior unique to perl?
<2> don't forget that you can use a perl trigger if postgres doesn't support the regex you want to use.



<0> beth: I don't know the first thing about triggers or PL/Sql unfortunately :(
<1> rutski89: yes
<0> pravus: ahh, ok; cool
<2> rutski89: it's easier than you thing. Use plperl and you can write your triggers in perl.
<1> rutski89: if you are using POSIX regex, use grep (etc) to test them
<0> pravus: huh?
<1> perl is a bad regex parser for POSIX-compatible stuff
<0> i see
<1> perl will spoil you
<0> hehe
<0> beth: I should definitely look into it sometime soon
<2> aha: http://www.postgresql.org/docs/8.0/static/functions-matching.html#FUNCTIONS-POSIX-TABLE
<6> beth's url is at http://xrl.us/nuws
<2> ^ describes postgres regex syntax
<2> the short answer is, it's similar to egrep
<2> the long answer is, well, on that page.
<1> you can hook perl into Oracle too... kinda scary :)
<0> beth: I've been on that page, but I haven't seen anything that detailed about $ or ^
<2> looks like $ matches the end of the string
<2> afaik the multiline match business is perl's own thing.
<0> beth: ahh, so it does
<0> beth: docs can be wrong though, I'll give it a test
<2> that doc was for 8.0, your version may vary.
<2> you want to eject your sleeves??
<2> you can just wear a tank top in the first place.
<0> beth: I'm on 8.1; it's probably the same
<7> beth: I will just ***ume that statement came from the fact that girls don't watch violent movies.
<2> rutski89: famous last words
<2> just s/8.0/8.1/ in the url and check it out.
<2> Debolaz2: funny, I thought it came from my irrepressible urge to misinterpret everything for humor value.
<7> Yeah, but that would've been too easy.
<7> :-)
<8> I think that the only thing Perl lacks is printing errors on the page when using CGI
<8> You refresh the page, and here's the error. You don't have to check Apache's log for that
<0> beth: yup, the docs are the same. And i just made a table and tested it, $ does in fact act like \z
<8> And sometimes you don't have access to Apache's log, and then you can only guess what's the problem about your code if the syntax is okay
<2> try CGI::Carp
<9> ofer0: i offered the solution but perhaps you missed it - use CGI::Carp.
<1> i have no problems tailing apache's error_log...
<8> oh
<8> damn im stupid :P
<1> like raw sewage, i love it
<8> thanks beth, jdv79 :)
<9> ofer0: i did mention that module the last time you were here like an hour or so ago:)
<9> have fun
<8> jdv79, oh, sorry.. i didn't notice
<10> hi hi
<2> hi
<1> EHLO
<9> people who speak SMTP scare me
<11> what about people who talk tcp/ip
<2> ACK
<12> domain cox.net not welcome, goodbye :)
<1> what about people that speak ethernet?
<1> ka24: no status number?
<12> arp who-has 127.0.0.1
<13> beth: SYN?
<10> moo
<9> ACKSYN?
<1> SYN,PSH,URG
<9> i'm not fluent:(
<11> jdv79: you could always talk in md5 and let people bruteforce what you were saying
<3> d257321a6ed51e2d40685f181a971b0c
<12> 88c862859462c068dfa7d3f09342ade2
<13> Freaks
<9> i actually had 2 binary files hash out to the same value with md5 a little while ago
<9> totally unrelated image files - weird
<3> buu: 278645d67c73cfabae25233c56502034
<13> Uh huh
<1> see you in a few years...
<11> *grin*
<12> a6308e7e9ec371d9bc046b3381759c07


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #perl
or
Go to some related logs:

#centos
ubuntu turn off utf-8
install ubuntu from a flash drive
#web
kubuntu rx620
#fedora
postfix smtp outbound only
functions convert from utf-8 to iso-8859-1 in php
#css
yum install htb



Home  |  disclaimer  |  contact  |  submit quotes