Regex

It is currentYear() and Perl STILL has the best regex implementation/capabilities out of any language.
What the fuck is going on?

Other urls found in this thread:

github.com/rust-lang/regex
rust-lang.org/en-US/friends.html
swtch.com/~rsc/regexp/regexp1.html
attractivechaos.github.io/plb/
en.wikipedia.org/wiki/Regular_expression#Patterns_for_non-regular_languages
benchmarksgame.alioth.debian.org/u64q/regexredux.html
twitter.com/SFWRedditVideos

github.com/rust-lang/regex

WTF is this lame Regex::new and verbose Java OO style shit? Also why you need library? Perl has them built-in as normal operators. Rust is lame, can't even compete with C, can't even compete with Perl. Stick with shilling in Go, Java, or other pajeet language threads tbh fam.

Are you retarded? Regular expressions are so named because they recognise regular languages. The turing complete abomination perl has is about as far away from that as it's possible to go.

perl: bloat
rust: minimal and well designed

perl: used
rust: isn't

rust-lang.org/en-US/friends.html

The interesting thing is that perl's regexes take exponential time to compute, while the original specification by Thompson made before Unix does not
swtch.com/~rsc/regexp/regexp1.html

Just what I expected from a group of sjw faggots that spend more time arguing about a retarded CoC than doing actual work. Is anyone competent left over there or did they chase them all away?

Rust is what happens when SJWs spend all their time trying to make a language that writes code so you don't have to. Their website is flashy web 2.0 because that's the only thing any of the major proponents know how to do: write flashy design-oriented websites that contain no useful information.


Shouldn't you be on reddit, arguing with anyone who doesn't use a language with forced memory-safety, and explaining how writing good code is literally impossible without a compiler to check your work for you?

Is there a comparison of modern regex implementations in the different languages?

Here is something
attractivechaos.github.io/plb/
(only showing the regex test for the image)
Pretty interesting results considering Perl has been even more optimized by now.

are you implying memory-safety is bad? if so rust lets you write unsafe code as much as you like.
not an argument

No surprise its userbase fits on a single webpage.

not an argument

It is when it restricts what one can do in their code. Memory safe is fine, constant autism and shilling about how it's the one true way is not. This argument is on par with the faggots that used to constantly shill for everything to be OOP.

Why bother when you'll just be shouted down by the community for doing it and have to put up with their stupid code of conduct? Rust is a great example of identity politics ruining something that could have been good. When most of the people that did the hard work of defining the standard and writing the compilers are chased away by moralfags you've got huge problems. Why should I bother working with software that chased away those that wrote it, constantly argues over bullshit, has a community filled with no-nothing faggots that obtain positions of power through the code of conduct, and attempts to infect every project written in their brand of autism with that same code of conduct? Even worse they've spread throughout the open source community attempting to enforce their rules on everyone to the point that they managed to kill github.

These people want Linus removed at the maintainer of the Linux kernel because they can't handle someone that speaks straight instead of fluffing up every e-mail with 100 made up feel good words. The world would be better off if they all got tossed into a burning building. Learning anything else would be a better option. Rust could have been something good and it makes me sad that it'll never be worth using because of the retarded community surrounding it.


He wasn't making an argument he was just telling you leddit is probably more your speed. Assuming you aren't just a retarded troll or shit poster. We know you're retarded at least because you're shilling for Rust. You've made that pretty clear.

oh no safe rust doesnt let you do unsafe things? not an argument.
what? look at the code the community wrote. plenty of unsafe code there.
what does this have to do with unsafe code? not an argument.

Ever tried to program in Rust, you LARPing faggot? It has a powerful macro system just to make it slightly less verbose, and it is still verbose as fuck. I haven't used a language that made me work for the language itself this much in years, and I am not even talking about the borrowing/ownership/lifetimes system. It is fucking painful.

I find more joy in programming Visual Basic than this overengineered piece of shit. Some of the concepts in it are nice, but it still needs a lot of work in terms of ergonomy.

Weak bait user. You can do better. You're just here to shit up a good thread with your Rust faggotry, why don't you return to one of those low-effort OP threads littering the board right now. No doubt in my mind some of those are yours. Or better yet KYS.

Sage because I'm engaging a shitposter. Sorry to contribute to shitting up this thread OP and other anons. Next time I reply to it I'll stay on topic.

Forgot to sage.

lol

...

i already did in the first reply

And it's not surprising in the least that your vocabulary of glib one-line "comebacks" fits in one post. Rust users, pff.

...

virtually all implementations of regex aren't regular languages: en.wikipedia.org/wiki/Regular_expression#Patterns_for_non-regular_languages

I really hate the rust-lang spammer.

i really hate Holla Forums. full of faggots who cant code

I'm not a regex expert, because I've never written an expression that didn't just work everywhere, so I really wonder what's so great about the perl regex and what the reason could be nobody else has bothered to copy it?

Actually everybody copied it
If you are using a regex engine that supports backreferences (\1, \2, etc) you are using a copy of perl
The difference is that in perl the language is built around them (not entirely, but close), unlike others in which regexes are an external library/package/whatever


It doesn't matter which year or version it's in the article, if you have backreferences the algorithm will still be exponential, thus taking a lot of time
Wether backreferences are a good thing or not is irrelevant, but the article raises a good point: instead of using only one algorithm, why not detect the presence of \1, etc and switch accordingly?
The overall complexity does not increase much, as it'll be O(n) to look up for backreferences, and then the algorithm complexity
Instead of getting 60 seconds for a relatively simple regex, you are slightly slowed down to scan the regex, but then you are fast even with "pathological cases" that would kill the backreferencing algorithm

Wat? Search for PCRE and you'll see how popular it is. But nevertheless, most languages require you to jump though extra hoops to use regex, whereas in Perl it's like any other operator, and without having to type all kinds of extra boilerplate shit. Perfect for doing one-liners, or just banging out something quick. Also to me the code is more readable WITHOUT all that fucking verbose boilerplate bullshit, and that includes all the shitty OO constructs that many modern "enterprise" languages force onto you. I mean fuck it, instead of reading all that bullshit, I can just rewrite the thing from scratch with less effort!


Those backrefs are from sed though, and they're now also in POSIX. See re_format(7) man page. But POSIX still doesn't have all the convenience and functionality of Perl.

FUCKING THIS

Regex::new("wow that was so hard\. kill youselves\.")

1. show us what a simple regex to match DOS newlines looks like in your language
2. explain why it's a visual clusterfuck

Regex::new("\r\n").unwrap().find_iter("oh wow what a visual clusterfuck. truly rust is shite and perl is the way to go. of course making regexes part of the language is not bloat. it is truly genius. i am a #perlmissile now.")

Nice, that does literally nothing.
Which other language makes regex as easy as this while also providing amazing performance?
s,\b(\D),uc $1,ge;

ok

rustc 1.17.0 (56124baa9 2017-04-24)error: expected one of `!` or `::`, found `(`
the power of rust strikes again!

Which other language has similar regex performance?
None.

you mean O(n^2)? lel even php is faster.

[citation needed]

benchmarksgame.alioth.debian.org/u64q/regexredux.html

What kind of shit benchmark is this, where PHP is faster than most compiled languages?

because php uses a regex engine implemented in c.

PCRE can compile to bytecode, perhaps it does that already?

Javascript is faster.
No, really. Go look it up.

#!/bin/env pythonimport reprint(re.findall(r'[hd]erp', 'herp lol derp foo'))
Wow, look at all this awful boilerplate, my eyes are literally bleeding right now.

And C's (and other langs) regex implementation is in what, execl /bin/sh -c "sed s/foo/bar/" ?
The overhead of PHP is still there, even if its libraries are in C. Not so with a compiled language. Unless the PHP libaries's implementation is soooo much better that it can make up for that overhead. Maybe possible for some cases, but dubious when it outperforms most compiled languages. That's a huge red flag for anyone who's paying attention that this benchmark is pretty lame.

Yes, compared to it's pretty fucking lame for a scripting language.

you are a living red flag

The Python code is readable even if you have never written Python before. The Perl code looks like someone had a stroke while typing.

stop being a script kiddie before you come back

I agree with that the Perl version is unreadable, but having to do Regex.new() or call methods just to scan some text it's a pain in the ass, especially when you do it a lot, that's true
I think Javascript's regex syntax is better (regardless of the rest of the language), since you define them with "/regex/modifier"
Readable and concise

How is it unreadable when literally every language copied Perls regex syntax?
JS even uses the very same with regex followed by flags.

So you guys write regex code to be readable??? lol

...

kek

compiled languages BTFO

I write it as complex as I can without being too ridiculous, because my colleague doesn't understand regex and I like to freak him out.

tell him to gtfo and look for a new job

I adore Perl, but perlre is one of the clearest examples of "just because you can, doesn't mean you should" you'll ever see. 99% of the time you shouldn't use features beyond what ERE normally provides you, and in turn that very often means all you really needed was Awk, which it's more likely your target system will have anyway.

If you're using flags like /e in particular then you badly need to reevaluate the way you're doing things. Don't treat Thompson's spec as an immutable gospel, but don't try to cram functionality better expressed in a loop or a subroutine into a regular expression, either.

I bet everyone in this thread praising perlre's byzantine misfeatures has used \d to match Arabic numerals before. Did you know that's wrong and you should be using [0-9]?

$ perldoc perlre|wc -l
2744

Keep it simple, guys.

proofs?

Or all the shilling about how you should never use gotos because your code will magically implode or become ancient hieroglyphs or something because you wrote a jump somewhere.

GOTO is fun, especially with line numbers.

kill yourself

HAHA! No, my adventure has only just begun! This week I'm doing ricing, to take a break tho.

Unless he's using GCC's labels as values feature, that numbering seems to be some bad labeling on his part.

There is too much retarded mental faculties that this image displays, I don't know where to begin.
Why the fuck are you using multiple printf statements to fit a long string for screen space? There is an enter key that exists on your keyboard.

My guess is that the numbers correspond to the original FORTRAN code line numbers, or whatever language it was converted from.

C o d e o f c o n d u c t

o

d

e

o

f

c

o

n

d

u

c

t