« first day (2083 days earlier)      last day (2842 days later) » 

11:00 PM
@Cerberus The current NLP parsers aren't perfect, but they do a remarkable job.
 
May 30 at 14:51, by Mitch
@FaheemMitha Nobody's perfect.
 
@tchrist They know tricks.
 
What do you mean?
 
I'm having trouble with Regex, by the way.
 
Because?
 
11:02 PM
@tchrist They know tricks, but they are gamble.
 
You parsen't.
 
@Cerberus latin is so highly marked, that I would think you'd barely need any common sense at all to assign meanings and referents and functions.
 
@tchrist There is a web page that I want to remove parts from (ads) through a userscript.
I'm trying to use lookahead.
It seems to work in Regex Buddy, but not in my userscript.
I can remove some other part of the page through a userscript, so it's something in the code that's wrong.
 
but for.. what was that language.. McWhorter had it as an example recently... where there was less inflection than English or Mandarin. and everything depended on context.
 
@Mitch Alas, no.
 
11:03 PM
I can't tell you what whatever library you are using is doing. I can only tell you how things are supposed to work if they aren't buggy. You should only test with what you will use.
 
@Cerberus regex is the best, but really, it's not the best.
@Cerberus the parsers work well for english.
 
@tchrist I'm trying to, but Javascript gives me no detailed feedback. Either it works or it doesn't.
@Mitch I like Regex.
 
jsux
 
and if it weren't for the liberties Latin poets take, I'd bet parsing would be straightforward for latin
 
Okay, wait a minute.
I've just noticed there is this flag "s".
 
11:05 PM
The dreaded 's' flag
 
It only matches when that's enabled.
Googling...
 
You're using dot.
It won't cross line boundaries without /s.
 
I'm using \s in the script where there could be new lines.
 
averts eyes
 
I thought \s also matched new line thingies.
I thought I had read that.
 
11:07 PM
It will.
 
But perhaps I should replace that with [\s\S].
Oh.
 
But dot won't.
 
Oh, wait, I'm stupid.
I missed a dot.
 
... --- ...
 
Now it matches in Regex Buddy.
Lemme try it in Javascript.
(I totally overlooked the flags in Regex Buddy.)
(Stupid name.)
Okay, now at least something is happening.
Just not the right thing yet.
The html is like this:
 
11:11 PM
Only I can parse HTML with reges, you know.
 
> jkfff
bla1 lhgkjgf
hgkjg
advertisement jhgg
bla2
hgkjgkljglg kjg
khg
bla1
kljglh
advertisement khg
kjhg lhulh
bla2
lkg
etc.
 
But this is a good regex resource in general: rexegg.com
Why aren't you using a spamvert blocker?
 
I want to remove everything between bla1 and bla2, but only if there's advertisement in the block, and I don't want to remove stuff in betweein bla2 and bla1.
@tchrist Because the ads are indistinhuisable to the blocker.
Only the fact that it says "advertisement" somewhere in the block is an indication.
I need the other bla1...bla2 blocks, which are real search results.
Example page: marktplaats.nl/…
 
What's the spam?
 
> /(<article\sclass="row\ssearch-result\sdefaultSnippet\sgroup-\d+\slisting-cas")‌​((?!<article\sclass="row\ssearch-result\sdefaultSnippet\sgroup-\d+\slisting-cas")‌​[\s\S])*<span\sclass="mp-listing-priority-product">Topadvertentie<\/span>((?!<art‌​icle\sclass="row\ssearch-result\sdefaultSnippet\sgroup-\d+\slisting-cas")[\s\S])*‌​<\/article>/g
@tchrist Those results that include the word "Topadvertentie".
 
11:15 PM
which one is correct?
- what happens to the queries
- what happens for the queries
- what happens in the queries
- what happens on the queries
 
I've come one step further already.
 
@stack all
 
But the above matches everything from the first bla1 to the last bla2.
 
@tchrist Odd ... but ok thx :-)
 
@stack It depends on what you want to say.
 
11:15 PM
@Cerberus I guess you have to say; "I've came ..."
 
They aren't all equally applicable.
 
@stack Nope!
Have goes with the past participle, not with the simple past.
 
@Cerberus I want to say, what happens about those queries? will they be executed or not?
 
@stack I would say with, or perhaps to.
 
@DanBron I prefer lingering donuts
 
11:16 PM
@Cerberus "come" is past?
@Cerberus ah ok thx
 
@stack Yes: it is both simple present (I come) and past participle (I have come).
 
@Cerberus Oh I see
 
The simple past is I came.
 
got it :-)
 
@snailplane Nice. Frankly there are too many good words. maybe a few of the bad ones could be removed. You know to set an example for the others.
Maybe there are only bad thoughts and we're just punishing the words as whipping posts..
 
11:20 PM
- after the queries
- after queries
?
 
/begin(?:(?!begin|spam|end).)*spam(?:(?!begin|end).)*end/s
 
"What happened with those queries? Did they finish?"
 
Oh!
Can Javascript do ?:
Let me test it...
 
No idea.
But if you don't use /s make the dots into [\s\S].
 
I read that Javascript can do lookahead, but not lookbehind.
@tchrist I've done that. Without that, it wouldn't match at all.
 
11:25 PM
while (s/(begin(?:(?!begin|spam|end).)*)spam((?:(?!begin|end).)*end)/$1$2/gs) { ... }
I have no idea how you do that in javasux.
The reason I'm whiling away in a loop is in case there are multiple instances of spam between a given begin and end.
Maybe you don't need that though.
 
I shouldn't.
@tchrist OMG it works!!
 
Well sure. It's just a regex.
It does what it's told.
 
Perfect!
 
It’s one of my few superpowers.
 
Well, 1. I wasn't sure whether all those looky thingies worked in Javascript, and 2. I found it hard to get the looky thingies right.
I knew I should not come to you in vain!
Look how clean the page looks now!
 
11:30 PM
It's a hell of a lot easier to read with whitespace, but jsux doesn't grok /x.
begin
(?:
    (?! begin | spam | end) .
)*
spam
(?:
    (?! begin | end) .
)*
end
 
Ah, yes.
That looks like it makes sense.
 
It's supposed to make sense. But without whitespace or comments, all hope is lost.
Notice how I make sure you match each begin with its next end. If you have nested ones, though, this is beyond the ability of jsux.
@Cerberus Isn't that what I already see, though?
Oh, I see.
ok
 
@tchrist "Topadvertentie" is the page's kind notification that those results are spam.
 
I see.
 
And the only way in which those results are marked as such in the html is by that bit saying "Topadvertentie".
@tchrist So how you made sure it only matches the next end (and not a later end) is by means of (?! begin | spam | end).
 
11:43 PM
Yes.
 
I just wasn't sure how Regex would deal with this nested pair of brackets: (something(?!blah).)*
 
Better.
HM, not yet.
 
By the way, why did you add this?: ?:
Why should it NOT capture anything?
Or is that just standard cleanliness?
 
I asked it not to.
Made counting easier.
 
OK.
Then I understand.
 
11:44 PM
Only capture what I wanted to put in the result.
 
Can I use references like <nameofcapturinggroup> instead of the second instance of "begin"?
 
I want one character which is not the first character of begin or end or spam.
In general? Yes. In jsux? No.
 
Oh, it doesn't do named?
OK.
 
To do anything with jsux regexes you should use that plugin whose name I forget.
 
I have heard of this.
But I doubt whether Greasemonkey will be able to use it.
 
11:46 PM
XRegExp by peoPle who cANnot maJuscuLate.
 
They should go late something else.
But I can use numbered references?
 
Yes.
 
OK.
 
Also, XRegExp will allow named captures. xregexp.com/syntax
 
I figured that plugin should add all the normal Regex things that Javascript lacks.
 
11:48 PM
Seems to.
 
I'm very glad you helped me solve this.
I will use it to block stuff on my other sites too.
Stuff that neither Ublock nor CSS will block.
 
Happy to oblige.
 
22 mins ago, by tchrist
begin
(?:
    (?! begin | spam | end) .
)*
spam
(?:
    (?! begin | end) .
)*
end
 
Pretty sure all this is in the Perl Cookbook's regex chapter, you know. :)
 
I still have some trouble understanding how the negative lookahead works when it's nested inside another group with the dot or [\s\S].
Hah.
I'm sure!
But I don't have that.
 
11:54 PM
The lookahead can look past the dot. Has to. But it anchors it.
I'm sure the pirated copy is out there, and the code you can download for free.
 
> compsognathus
Begin
horse
pig
End
ape
horse
Begin
ass
End
dog
 
Is it bad that the first thing I thought of when I saw "lookahead " was that a good S.W.R. answer would be "scout"?
Hi guys.
 
Hi!
 
@Tonepoet I wouldn't call that bad but...
 
I'm still not sure I understand at what moment in the process of regexing the anchoring happens.
 
11:56 PM
@Tonepoet It’s because of your Indian heritage.
They were always famous scouts, even eagle scouts.
 
Or does it anchor every single character (dot)?
 
Something like that, yes.
 
It looks for a character that isn't preceded by Begin.
 
Well.
 
It finds h (from horse).
Then it looks for a second character, and finds o, also not preceded by Begin.
 
11:58 PM
It's a character that is not the first character in Begin | Spam | End.
And there's no skipping.
So it can only match characters that don't start those three.
Hm.
That isn't what I meant.
 
I'm not sure I understand that: I could read that as "a character that is not B or S or E", because those are "the first character of Begin|Spam|End".
 
It only matches characters that are not the start of those three at that point. It can match Beggar just fine.
@Cerberus That's what I said wrong.
 
OK.
 

« first day (2083 days earlier)      last day (2842 days later) »