« first day (3869 days earlier)      last day (1044 days later) » 
00:00 - 19:0019:00 - 00:00

7:00 PM
@CowperKettle They probably saw only corruption by the individual landowners and wanted that to stop. YOu just don't know the consequences of changes sometimes until you do them.
Sometimes nationalizing gets rid of foreign owners.
 
I've read that Vladimir Lenin was a bit shocked that nationalizing everything led to extreme rise of bureucracy. Well.. hm. What was he imagining?
 
@Robusto yes
 
@CowperKettle It's like debugging some very complicated code by just getting together to talk about it.
 
@Mitch Yes, I can see the reason in getting rid of foreign owners.
 
@tchrist What do you think?
 
7:03 PM
mac(tchrist)% echo 'Goto chat.stackexchange.com/rooms/95/… and to chat.stackexchange.com/rooms/95/… for more info.' | perl -nle 'print "PRE=<$1> + MATCH=<$2>" while /([^"]*\s*)(https?:\/\/[^\s"]+)/gim'
PRE=<Goto chat.stackexchange.com/rooms/95/… and to > + MATCH=<https://chat.stackexchange.com/rooms/95/english-language-usage-multi-layered-discourse-room>
The stuff in the first submatch is going a gobbling.
 
Ohhh.
 
That ([^"]*\s*) bit.
You only make it gobble non-double-quotes. You don't make it stop before a URL.
 
@CowperKettle The question isn't whether nationalizing is good or bad but how much and in what industries and at what level. Like I think it is an extremely good idea that the road system is nationalized (I think in pretty much every country).
 
@tchrist I put that in because I don't want it to find URLs that are already inside an HTML anchor tag.
 
I think a lot of abuse in the prison system is happening because it is being privatized.
 
7:05 PM
Well, this becomes harder.
 
Yes, I've read that the road system in the UK started working poorly after privatization.
 
@CowperKettle and the trains? something like that.
 
Yes, the train system
 
trains were never great in the US, I think Amtrak is pratically privatized?
 
There are no quick-and-dirty solutions if you're worried about a mix of markup and nonmarkup.
 
7:06 PM
When I had the BBC TV channel, they were constantly saying "look at France, the nationalized train system is fine"
 
@tchrist I'm trying to grab text URLs that aren't already in anchor tags and encapsulate them in an anchor tag of their own with the text of the URL truncated. It works fine except it only finds one URL per text string.
 
@CowperKettle Germany's is pretty good.
 
Russian trains have been running on schedule the last decade. But that partly may be due to the fact that in the Soviet years the system was used to a higher load. There was a developed industry that used the train system.
 
@CowperKettle again I don't think nationalization or privatization by themselves are bad things, it is how it is applied.
 
I remember that we had to wait hours and sometimes days for trains and planes arriving late, during the Soviet times.
These days, you can set your watch by trains. They arrive on the minute.
 
7:09 PM
mac(tchrist)% echo 'Goto chat.stackexchange.com/rooms/95/… and to chat.stackexchange.com/rooms/95/… for more info.' | perl -nle 'print "PRE=<$1> + MATCH=<$2>" while /((?:(?\!https?:)[^"])*\s*)(https?:\/\/[^\s"]+)/gim'
PRE=<Goto > + MATCH=<https://chat.stackexchange.com/rooms/95/english-language-usage-multi-layered-discourse-room>
PRE=< and to > + MATCH=<https://chat.stackexchange.com/rooms/95/english-language-usage-multi-layered-discourse-room>
 
Some mail/parcel carrying is really good because of privatization (in the US: FedEx, UPS, Amazon, DHL) but having a public system too has benefits for those services that the big companies don't cover.
 
@tchrist Hmm. I'm trying to think of how to make that work in the JavaScript regex parser. I know you don't have a high opinion of JS, but that's what I have to use for this.
Thank you, though.
 
#!/bin/sh
echo 'Goto chat.stackexchange.com/rooms/95/… and to chat.stackexchange.com/rooms/95/… for more info.' |
  perl -nle '
    print "PRE=<$1> + MATCH=<$2>" while m{
      (
        (?:
          (?! https?:// )
          [^"]
        )*
        \s*
      )
      (
        https?://
        [^\s"]+
      )
    }xgim;
  '
Yeah stupid JS can't handle /x so you can read it.
But spacing it out, do you see what I did?
I said that your not-quote can't be the start of your https thingy.
 
Yes.
 
I think the standard JS regex engine can handle lookahead negations like that. If not, the drop-in one can.
 
7:14 PM
@CowperKettle I'm annoyed by the scheduling of flights to Mars. I mean I can understand a few weeks delay because of the Hohmann transfer orbit, but then they should reduce the price for off-peak flights.
 
@tchrist I'm going to try to work with that. Thanks.
 
You're also banking on this being only doublequote delimited not singlequote. But if you know your data, that's ok.
 
@tchrist Yeah. HTML always double-quotes attribute values. No singles.
 
You sure?
Thought either was allowed.
 
It's been my experience over the last 25 years of HTML.
If you view any page source and find single-quoted attributes, I'll be surprised.
 
7:16 PM
Here's an explanation of all the silly "not" stuff you need here.
6
A: Using Regex to search for a string that contains "http://" and does not contain "mysite.com"

tchristWARNING Attempting to rope regexes into boolean logic best accomplished in a proper programming language is a thankless job. While it is possible to write /PAT1/ and not /PAT2/ using complex lookaheads so that it is just one pattern, it is a painful task. You don’t to do it this way! You shoul...

 
@tchrist But I think HTML 5 allows unquoted attribute values, so maybe I'm just living in the past.
 
@tchrist cripes, they should just add in APL commands already
 
@Robusto Eek.
 
Right?
 
In a production environment rather than a quick hack, I'd normally do something that loads up the DOM so I can get at the values of the strings without worrying about markup.
Because you're still trying HTML with a regex, which is a thankless task. It's possible in Perl if you try hard enough (you don't want to, trust me) but not in JS.
696
A: What to do Regular expression pattern doesn't match anywhere in string?

tchristOh Yes You Can Use Regexes to Parse HTML! For the task you are attempting, regexes are perfectly fine! It is true that most people underestimate the difficulty of parsing HTML with regular expressions and therefore do so poorly. But this is not some fundamental flaw related to computational theor...

Like I say there: "Regexes optimal for small HTML parsing problems, pessimal for large ones"
2
 
7:21 PM
Etymology of the day: surgery = work using your hands = from χείρ (kheír, “hand”) + ἔργον (érgon, “work”). In antique English, chirurgery
 
@tchrist I'm basically grabbing text from inside <p></p> HTML elements and running JavaScript String.replace() on the innerHTML contents of them.
BTW, I love pessimal. ^_^
 
pessimal is the worst
 
You wouldn't say that if it had bacon in it.
 
snort
 
Here's the whole jQuery plugin I created:
(function ( $ ) {

    $.fn.url_sub = function( ) {

        return this.each(function () {
           let $this = $(this);
           let txt = $this.html();
           let newtxt = txt.replace(/^([^"]*\s*)(https?:\/\/[^\s"]+)/gi, function(match,p1,p2){
                let trunc = p2;
                if (trunc.length > 30) {
                    trunc = trunc.substring(0,30) + "...";
                }
                return p1+' <a target="_BLANK" href="'+p2+'">'+trunc+'</a> ';
             });
And that is called by this:
 <script type="text/javascript">
    $('.ride-single').find('p.text').url_sub();
 </script>
 
8:01 PM
I don't know whether there are any hidden language learning experts in here who would like to become a mod, but Language Learning SE having an pro tempore mod election next month. (Only an announcement for now.)
 
8:59 PM
TIL the Mexican-Spanish bodega comes from Latin apotheca < Greek apotheke. So it's related to apothecary.
 
@Tsundoku Thanks for the announcement, and good luck!
@CowperKettle Yes, in Dutch: chirurgie.
 
9:30 PM
@tchrist So I got it working, thanks. I had to take out the ^ prefix as well. I don't do this stuff every day anymore, so moss has grown on my coding acumen.
 
@Robusto This has probably been solved, but I'd expect [^"]* to match almost the entire string, then move leftward some distance from the end until it also matches the (rightmost) URL, but no farther leftward. So it will consume all URLs to the left of the final URL, unless any URLS are separated by double quotation marks.
But Christ has probably solved everything already.
 
@Cerberus I never took you for a Christian before.
 
Oops.
 
@Cerberus Yeah. I don't do this every day anymore, so my brain gets foggy.
 
I like Regex.
 
9:38 PM
Me too. It takes me a while to get my brain around it now, where in my working life it was something I did almost every day.
I can't believe I've been retired for five years now.
 
That's long.
 
The only thing I'm doing is my cycling club's website, and I did the bulk of the work on that four years ago already. Now it's just maintenance, and new features as needed.
 
What I like about Regex is that its relatively few wheels and knobs can solve almost any problem you throw at it (although in many cases using something other than Regex might be more efficient or easier).
 
Actually, I had to make another adjustment just now. I have to put the not-doublequote in front or it fucks with pre-tagged anchor links.
This is the final: /([^"])(https?:\/\/[^\s"]+)/gi
@Cerberus What I like about regex is how fucking powerful it is. To do what it does any other way would require prodigious effort if it could be done at all.
It's like a get-out-of-jail-free card.
 
10:04 PM
@Robusto What language is this?
Using a negative lookbehind, or \K, would allow you to ditch the groups.
@Robusto Exactly.
Before I understood Javascript or the DOM, I used to do everything with Regex, because it was the only thing I knew, and it worked.
 
 
2 hours later…
11:47 PM
@Cerberus JavaScript's implementation of regex.
 
00:00 - 19:0019:00 - 00:00

« first day (3869 days earlier)      last day (1044 days later) »