« first day (1423 days earlier)      last day (3532 days later) » 

3:00 PM
@RyanKinal you can have stored procedures instead but I don't really enjoy managing those.
 
4428
A: RegEx match open tags except XHTML self-contained tags

bobinceYou can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool th...

 
ugh stored procedures..
I like them but they are such a pita to debug
 
Oh look, zigi found one of the most famous SO questions.
 
@Loktar then don't put bugs.
 
never seen it before
 
3:02 PM
@BenjaminGruenbaum Yeah, I actually kind of like the .sql file solution... it allows relevant SQL to be part of the repository, and versioned, and all of that stuff.
 
so, why is it bad to parse HTML with regex, what if you want to remove all tags from your textinput
 
@ziGi Use a DOM parser
 
... READ THE QUESTION
 
@RyanKinal It makes it easy to run the .sql files in isolation in your console with different parameters.
 
:D
 
3:03 PM
You just linked to the question that has the answer to that question
 
86
Q: Using regular expressions to parse HTML: why not?

ntownsendIt seems like every question on stackoverflow where the asker is using regex to grab some information from HTML will inevitably have an "answer" that says not to use regex to parse HTML. Why not? I'm aware that there are quote-unquote "real" HTML parsers out there like Beautiful Soup, and I'm su...

@BenjaminGruenbaum Definitely
 
That's like people posting an question on SO, with a link to the question that answers it
 
I'll propose it
 
umm I currently do it like this: github.com/Ralt/spa/blob/master/cat/db.lisp
but I like your idea, Benji
(don't mind the cat/get-all-types that should be refactored out.)
 
@RyanKinal and what does the dom parser use?
 
3:05 PM
Logic
 
@AwalGarg Probably a recursive descent parser
 
can I select two list items using two class selector ?
 
Though it depends on the implementation
 
nope, they use regex as well.
 
@AwalGarg Maybe to tokenize, but not to parse
Biiiiig difference
 
3:06 PM
I just notices how much battery this chat leeches from my phone o.O
 
Browsers too have to interpret html ofcourse and they too use regex! (I am just inventing this from my mind, so don't trust it).
 
I though that saying Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML was just a joke
 
> (I am just inventing this from my mind, so don't trust it).
 
@RyanKinal as you say. I just speculated that...
 
apparently I am not really skilfull in regex
 
3:07 PM
So you're just assuming they use regexes?
 
Translated: Disregard everything I say in relation to this subject
 
lol
lolol
I would append please in front of it.
 
@Cerbrus I though you use regex to remove everything that starts with < and ends with >
to remove all tags from a text
 
s/append/prepend/
 
@RyanKinal because data mapper architecture lets you separate the persistence abstraction (which in this case would be handled by ORM) from the "what is being persisted"
 
3:09 PM
I was talking about stripping not parsing, that's why there is a confusion
 
@Zigi, any regex you write to remove html from a string, I can brak.
 
that way you can save various objects in in same data structure or save same object in various data structure
 
Stripping, parsing, both require recognition of HTML
Err, break, not brak. Can't edit on my phone, it seems
 
@Cerbrus what about String target = someString.replaceAll("<[^>]*>", "");
 
actually you can
 
3:10 PM
hahah I got the easter egg
hahahahah :D
 
My chinese coworker just brought in moon cakes. They're pretty good!
 
user2620028
googles moon cake
 
user2620028
Oh cool
 
var string = "some text that contains 10 < 20". Broke it.
 
Made with real moon?
 
3:12 PM
Your turn
 
@ziGi silly you
 
@Cerbrus what regex are we writing?
I wanna try
 
Strip html from string
 
user2620028
@taco now with 40% more moon!
 
3:13 PM
('/</g', "&gt;");
no broke
 
@Cerbrus can we assume all tags are in the form of <tag attr="value"> ... </tag> ?
 
Ask zigi anout the specifics. i just assumed the <> can be in the string
 
 
@AwalGarg those aren't required.
 
user2620028
lol aqua team hunger force
 
3:13 PM
@BenjaminGruenbaum and why?
 
$('#FiltersMenu li.classOne.classTwo').show();
why this isn't working :/
 
@AwalGarg No, I mean <b>hello there > </b> is valid HTML
 
yes, just remove the <b> infront and the </b> after
 
Even without the lt/gt bit.
 
I want to show all li that either has classOne or classTow classes
 
3:14 PM
@CustomizedName probably not finding the element
 
Oh, are we proving that regex can't parse html?
@CustomizedName so use ,
 
@BenjaminGruenbaum Yep
 
That's a cute proof with the pumping lemma
 
@BenjaminGruenbaum That is such a vague sentence.
 
user2620028
A friend of mine just made an html parser with regex... or claimed to anyways
 
3:15 PM
Who wants a proof?
@AwalGarg It's really not
 
@BenjaminGruenbaum zigi
 
@BenjaminGruenbaum we are talking about stripping html from string not parsing html
 
@ziGi just as impossible. Soz.
 
like this,


$('#FiltersMenu li.classOne, #FiltersMenu li.classTwo').show();
 
@BenjaminGruenbaum it is, for very specific tasks, we can use regex... but just because we can, doesn't mean we should.
 
user1596138
3:16 PM
@NickDugger Yeah I delete most of them anyway. If I don't know you don't fucking give me personal sentiments just because facebook suggested it lol
 
/<.*>/g, ""
 
$('div').html(myString).textContent() wouldn't something like this work?
 
@BenjaminGruenbaum I do, actually. I'd love to see an actual proof.
If only for future reference.
 
@RyanKinal do you know what a DFA is?
 
user1596138
Like some chick I met in Canada just posted to my wall and said happy birthday and gave me a Bible verse
 
3:16 PM
<my cool html tag>my cool text</my>
 
@BenjaminGruenbaum Deterministic Finite Automaton?
 
!!s/<.*>/""/
 
@NickDugger "" (source)
 
(Wiki'd it)
 
I fail
 
3:17 PM
@RyanKinal I've got to run now, but I want to see the proof. Could you create a bookmark when he's done explaining?
 
@RyanKinal Da Furious Answerer
 
> dfa
DFA is an Italian progressive rock band from Verona, Italy. Their musical style is varied, but has elements of "space rock" bands such as Pink Floyd and jazz-rock fusion bands like Nova or In Cahoots.
 
@SomeGuy Yerp
 
ok so how do you strip the html tags from a string
 
Thanks!
 
user1596138
3:17 PM
Last year by this time on my birthday I had rear-ended a car on my motorcycle. The year before that I had hit a telephone pole. So I'm not sure if I should stay inside to stay safe or if that would bring the house down on top of me?
 
@Jhawins Best get out of the house.
 
@BenjaminGruenbaum how does strip_tags work in PHP then
 
user1596138
@Sippy Too bad I'm at the office :/
 
@BenjaminGruenbaum hey we are all waiting. (just so you don't assume we are not interested)...
 
@Jhawins Let's hope they don't charge you for the damages :D
 
3:19 PM
@Jhawins Go to the pillow factory, find the biggest mound of pillows you can find, wait it out
 
@ziGi regex, and very bad implementation of it. strictly discouraged.
 
string.replace(/<.*>/g, "") works outside of SO chat -- to strip HTML tags
 
@ziGi also, in PHP, all FILTER_VAR thing is regex based too.
 
user1596138
Yeah lol. Will do
 
user1596138
The Nestle factory isn't far from here! That might be fun!
 
3:20 PM
@ziGi If you need to seriously parse HTML with PHP, use DOMDocument.
 
You can't make chocolate out of javascript
 
The interface is almost identical to JavaScript's
 
@SecondRikudo that is probably the best option after HTMLPurifier.
 
The proof scheme is basically:
- We define a simple abstract module of computation called a [DFA](http://en.wikipedia.org/wiki/Deterministic_finite_automaton).
- We define a non-deterministic alternative called an [NFA](http://en.wikipedia.org/wiki/Nondeterministic_finite_automaton).
- We show DFAs and NFAs are equal in expressive power through the power set construction - that is we turn every NFA to a DFA and vice versa.
- We define a regular expression.
- We define an extended NFA as an NFA that allows regular expression over its edges.
2
It's quite a proof, actually. @RyanKinal it's kind of long for chat
 
 
3:21 PM
@Jhawins Don't break the nestle factory god damn it!
 
I don't see how this breaks
 
Basically, the idea is that regular expressions don't have memory, but HTML requires memory to parse since nested tags require knowing how deep down we are.
 
@AwalGarg No, that is the best option period.
 
@ziGi nest it three levels, and then add attributes :)
 
@SecondRikudo In the context I meant. If you are looking forward to parse HTML with regex, you better go with the library since you possibly don't know about the inbuilt tools.
 
3:23 PM
@RyanKinal the whole proof is in Sipser's "Theory of Computation", he explains it much better than I can hope to
 
user1596138
@Sippy Oh you're right!! That would be bad
 
user1596138
The Eddys ice cream plant? xD
 
@zigi: add some loose <'s in your string
 
@BenjaminGruenbaum I'll see if I can't look it up
 
!!> '<b><i><u style="display: inline-block;" onclick="function() { doStuff(); }"> asdfas > </u></i></b>'.replace(/(<([^>]+)>)/ig,"")
 
3:23 PM
@SecondRikudo " asdfas > "
 
@BenjaminGruenbaum ^
 
user1596138
Anyway I'm 20 now guys. More hirable? Less hirable? Who gives a fuck I hate birthdays cause it just makes me look at all the time I wasted this last year
 
 
@SecondRikudo what're you showing me?
 
@BenjaminGruenbaum Nested 3 levels and added attributes
 
3:24 PM
yes me too
kind of works
 
@SecondRikudo wanna bet a beer I can break it?
 
@m59 For future reference, I don't mind if you post pictures of me, as long as you're reasonable about it.
 
@BenjaminGruenbaum Oh, I know you can break it
 
@BenjaminGruenbaum how can you break it?
 
@BenjaminGruenbaum I wanna see you do that, but no beer bet. I am a teetotaller.
 
3:25 PM
Like I said: "<"
 
!!> "<b a='<b>'><i a='</b>' /></b>".replace(/(<([^>]+)>)/ig,"")
 
@BenjaminGruenbaum "'>' />"
 
@BenjaminGruenbaum yeah, that's moronic and has no sense
who puts an attribute with a tag in it
 
@ziGi it's a) valid html and b) breaks the regex
 
3:26 PM
haha
!!afk gonna go cry in the corner
 
@ziGi Really?
 
@ziGi also, lots of people, I've seen <div tooltip="<b> This does foo</b>">?</div> way too many times.
 
!!>'<div tooltip="<b> This does foo</b>">?</div>'.replace(/(<([^>]+)>)/ig,"")
 
<a data-tooltip="<b>Note!</b> <span>this is crap!</span>">link</a>
 
It can be simpler like "<b id='</b>'></b>", I just wanted it to look fancy :P
Your "Tag has ended" needs a backreference (look up those in regex, JS has them) which would make your regex not really regular.
With a backreference, it would still need to know if it's an attribute string context or not, it can do that too.
 
3:29 PM
All that aside
Who the fuck parses HTML with Regex in JavaScript?
 
With those two tools you should be able to clean HTML, sorta
@SecondRikudo like ten thousand people on Stack Overflow :P
 
@SecondRikudo lololol
 
I can understand (sorta) the twisted logic behind doing it in PHP
But in JavaScript?!
 
It's not like JS has access to any DOM methods, rite?
 
much like php :P
 
3:32 PM
@BenjaminGruenbaum The difference is that it's 'scary' in PHP
 
Everything is scary when all you have is a double clawed hammer :D
 
You need to instantiate a big scawwy object and do this OOP thingamajig.
 
!!urban php
 
@NickDugger [php](http://php.urbanup.com/496093) Setting things straight ...

PHP began life as "Personal Home Page" (Tools), and later the "Personal Home Page" (Construction Kit). Later it would be merged with an [\[SQL\]](http://urbandictionary.com/define.php?term=SQL) query tool for webpages and become PHP/FI, or "Personal Home Page / Form Interpreter".

FastForward to the present day and it's no longer a mere tool to handle generation of Personal Hom(snip)
 
And that sums up the conversation :D
 
3:33 PM
Not what I wanted :(
 
!!afk commuting. ‮Try not losing the game this time.
 
@SecondRikudo I hate you
 
@SomeGuy SecondRikudo is afk: commuting. ‮Try not losing the game this time.
 
I lost the game
 
3:35 PM
I am the game
 
@NickDugger Are you a girl O.o
 
^ The Game
 
@RyanKinal Loooool, deep
 
@CustomizedName How can I be a girl if my eyes aren't real?
 
@NickDugger ... wtf just happened
 
3:39 PM
I tore a hole in space/time
 
am lost in space
 
user1596138
.onebox {
    display: none;
}
 
<bragging>My code works in IE8!!!</bragging>
 
user1596138
@NickDugger Yup this is why
 
3:45 PM
Why what?
 
Why he hides oneboxes
I guess
 
Ah, makes sense
 
user1596138
Because stupid collages of Jaden Smith lol
 
!!refresh
 
3:55 PM
 
!!refresh
 
@Feeds what does this means
 
Good morning, sleepy head
 
user2620028
Lol lemon you intentionally messing with tyler?
 
3:58 PM
testing a bug
 
user2620028
omg we have a shin chan in chat :) thats awesome
 

« first day (1423 days earlier)      last day (3532 days later) »