Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "regex"
-
This shit is real.
Guy comes to my desk.
Guy: Do you know Python?
Me: Yes
Guy: I want a program that reads a CSV containing IP addresses and tells which of them are valid.
Me: Sure thing. Show me the CSV file.
Guy: (Shows the file)
Me: (Writes a small function for checking whether the IP is valid)
Me: Done Here you go.
Guy: You should be using regex.
Me: Why? This is perfect. No need for regex.
Guy: My manager wants a solution using regex only.
Me: Why so?
Guy: I don't know. Can you do it using regex?
Me: Only if you say so. (Stackoverflow. Writes a humongous regex). Done!
Me: Just for curiosity, what is your application?
Guy: I will port it in Java. You see, regex is easy to debug.
Me: Ohhh Yes. I forgot that. Good luck with your regex.22 -
4+ years of programming.
Still have no clue how to make my own regex pattern.
Every single time I need to, I always open 4 cheat sheets and/or stackoverflow.24 -
Front-end dev: email domains other than Gmail and Hotmail exist?!1! 😱 And email regex, what the hell is that? 😵30
-
RegEx is same magic as machine learning. You punch the keyboard untill you get desired output, just a bit less cool.8
-
“That regex almost worked, lemme just tweak it a bit–”
*2 hours later*
“Fuck it we’re processing strings character by character with a while loop like granddad did.”5 -
API Guy.
He has a serious regex problem.
Regexes are never easy to read, but the ones he uses just take the cake. They're either blatantly wrong, or totally over-engineered garbage that somehow still lacks basic functionality. I think "garbage" here is a little too nice, since you can tell what garbage actually is/was without studying it for five minutes.
In lieu of an actual rant (mostly because I'm overworked), I'll just leave a few samples here. I recommend readying some bleach before you continue reading.
Not a valid url name regex:
VALID_URL_NAME_REGEX = /\A[\w\-]+\Z/
Semi-decent email regex: (by far the best of the four)
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
Over-engineered mess that only works for (most) US numbers:
VALID_PHONE_REGEX = /1?\s*\W?\s*([2-9][0-8][0-9])\s*\W?\s*([2-9][0-9]{2})\s*\W?\s*([0-9]{4})(\se?x?t?(\d*))?/
and for the grand finale:
ZIP_CODE_REGEX = /(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)|GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\d{1,4}/
^ which, by the way, doesn't match e.g. Australian zip codes. That cost us quite a few sales. And yes, that is 512 characters long.47 -
From Reddit
Q: Is there a word that describes a fear/phobia of regular expressions?
A: Common Sense3 -
Installed my pihole a few days ago and not a very high percentage blocked.
Added google/facebook/twitter and some more to the wildcard (regex) blacklist and BAM, so many blocked queries!
Fuck Google, Facebook, twitter and other mass surveillance companies.26 -
Small Me(m): learning some basic code
Senior Dev(d): *walks by and sees my code*
m: hey got any advice on this?
d: learn to use regular expression. *walks away*
m: 30min later... *Mind blown*
And coffee of course ☕2 -
Just realized I'm commenting about how to summon Cthulhu with regex, while my upvote count is 666...
Őh bøy. Ţhįş įs ÑØŤ ģôíņğ ţø ęňđ węļĺ6 -
Just found this website for Regular Expressions:
https://regex101.com/
In-case anyone struggles like I do10 -
Today I wrote a regex expression that worked on the first try. Today I learned that the hardest code to debug is bugless code.6
-
A small bug is found.
Chad dev:
😎 *Exists*
> Writes a simple ad hoc solution in a few lines
> Self documenting code with constant run time
> No external dependencies needed
> Fixes the bug, easy to test and does not introduce any new issues
That guy nobody likes (AKA. regex simp coder):
🤡 'This can be "simplified" into oNE LiNe'
> Writes a long regex expression that has to line wrap the editor window several times
> Writes an essay in the comments to explain it's apparent brilliance to the peasant reader
> Exponential run time (bwahahah), excessive memory requirements
> Needs to import additional frameworks, requires more testing that will delay release schedule
> Also fixes bug but the software now needs 2x ram to run and is 3x slower
> Really puts the "simp" in simplified, but not the way you would expect26 -
An ancient scripture describing our impending doom found on Stack Overflow
https://stackoverflow.com/questions...6 -
Was going to install python 3.5. Typed "apt-get install python 3.5" instead of "apt-get install python3.5".
Parsed 3.5 as regex, now it's installing 500mb of shit :/6 -
"Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems." - Jamie Zawinski1
-
So my teammate posted on our Slack channel:
^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&‘*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$
Then our manager asked him: "Are you swearing on Slack!?"
No sir, thats Regex.4 -
If archaeologists from 1000 years in the future find a fossilized copy of your code? What would they think about it?
Regex would definitely classify as alien manufacture.15 -
Are you a iOs developer/Android developer/graphic designer/web developer/3D artist aged 18 - 30? Are you fluent in English, both written and spoken? Well, that's nice , Good day 🤡1
-
Fuck i love regex... managed to replace a series of loops and if statements with regex and cut execution time from 60ms down to 5ms13
-
A few months ago my now boss, then he was my mentor and school teacher asked for my help with a feature, said he had tried for some time and couldnt get around it, I solved it with regex in less than a day, and the company is like the golden standard of my region. The issue itaelf wasnt hard but being able to help my mentor was pretty cool
-
Learning regex is like finding a scalpel when thus far you've been trying to dissect a frog with a chainsaw.4
-
I learned how to solve some problems using XOR.
This might be like when I learned to love regex.
*loud laugh reminiscent of Vincent Price in the Thriller music video*
What am I becoming?13 -
I just wrote this piece of code. Without googling. Call me regex king!
But in fact regex is not that hard, you just have to learn the syntax 😄28 -
When I was a kid I fucked with a ouija board and now trying to debug massive regex expressions I swear Satan has finally come to screw me9
-
Oh dear, a scaling problem I solved was replacing some Regex matching with simpler string functions. While I'm a huge fan of Regex, it's unreal how much performance they can suck out of some high-n loops...
I got about 120x out of some critical code thus making a CPU upgrade unnecessary.8 -
Me: *opens FB in mobile web browser*
FB: You there! Go ans get our great Facebook Lite app! It is faster and...
Me: Nope! *clicks X to dismiss*
FB: Nope! *a wild code appeared*10 -
Regular expressions is like a condom, it's safe, combat tested and works most of the time.
But if you use it too much it gets dirty quickly.3 -
import do
import re
import mi
import fa
import sol
import la
import si
You know which one is the real module13 -
Regex.
I HATE YOU.
There. I've said it.
I spent the better part of the last hour trying to wrangle together, not one, but TWO regexes and getting them to work with Python's "re" module.
The worst part about these little shits? It's how well they work once you figure out how to get them to work. For example, pulling a phone number out of a paragraph is difficult with string methods, but cake with regex . . . if you can figure out the pattern.
But I think I'll always have hate in my heart for Regex just for how obtuse and frustrating they can be.
F**k you regex.19 -
When you forgot to escape characters in regex and wonder why the fuck it’s not working for 2 hours. 😖
Why regex must you be a living hell!3 -
I've been guessing all regex's in my past projects... If I'd be in a regex written exam, I'd be a goner.
ヽ(・_・;)ノ7 -
Fuck regex and everyone who has ever endorsed the use of and/or is affiliated with regex.
It's unreadable, impractical, overly complex and complicated and it adds unnecessary clutter to your code, and your thought process.
It's 00:50 am and I just spent 3 hours debugging a regex only to realise forgot a single "?" in a 75+ character long string and I want to go to bed.13 -
Just updated my nodejs http handler.
- You can match request paths via regex now
- Serve paths can be relative or absolute now
- Still 0 dependencies
https://npmjs.com/package/...3 -
To all the web developers out there that use email validation, stop using a check for common domain names! If I try to sign up with my email address (something@coded-websites.be) it won't work! So stop doing that and use a RegEx please! Who has had this problem too?11
-
New developers(5-6 years experience) these days are so pathetic. They dont have any sense of code review. All they want is to put their opinion out without giving any thought.
I had a PR for review today which contains mock specification to match a regular expression and return the corresponding response
The regular expression I put was
104000(02|06|20|48)
Now, this guy comes and puts a comment that we could "simplify" as 104000\d{2}
I replied, the ending digits are not contiguous. The specific pair of digits have to match for these mocks.
Then this guy replied, then we could simplify as 104(0{4}(2|6)l0{3}(20|48)).
I said, I cannot understand how that is simplification. Why do we need such a complex regex to match something very straight forward.
And the guy replied, we should be writing proper regexes, otherwise we could just specify everything explicitly.
I was like WTF man. You try deciphering this next week without taking at least a minute to know which values are matched.
Anyhow, another senior person approved my PR, and I merged it.12 -
Yes you can have hyphens in email addresses, you incompetent nincompoops!!! Just use the standard regex for email validation and stop trying to make your own rules!!!!21
-
I spent almost 10 hours coming up with this RegEx. Trial and erroring my way to hell. First I had get rid of the HTML tags (which was easy-ish) then I spent most of my time trying to figure out how to remove the god damn dash but keep hyphenated words ....... Then I found \B and look behinds...
I am making it a point to get good at this shit... Because right now I am petrified of it... Fuck you Regular expression you have taken away all my emotions...14 -
Programmer 1: We have a problem
Programmer 2: Let’s use RegEx!
Programmer 1: Now we have two problems -
Him: "I don't need source control, it's just another program that does unknown things on my source files. What if one day it stops working?? How do I get my files??"
Me: "you could say the same thing on 90% of the tools you use every day... Like when you restore npm packages by GUI"
him: "what are those? I don't use them"
Also him: "command line is vintage"2 -
Meets a family member****
Fam.Member: Hey so what do you do now?
Me: I work with a tech company
Fam.Member: Nice. As what?
Me: Software Engineer
Fam.Member: oh IT stuff. Can you check my phone for me, it's slow now.
Me: No (then walks away sipping my drink)7 -
I feel like Stackoverflow is a fastfood for programmers mind. It gives you a solution you starve for. It may be not the best quality, but it works for now. It does not satisfy you in a long run, and may be too shallow for advancing. But it works and gives you more to think about.
I would never find a quick solution to parse a string with regex. I never thought it works this way. But hey, I'm happy.9 -
I had to make Google forms but it got boring after sometime (with drag and drop). So, I ended up learning regex. Phew! That was little hard.4
-
Me: yo DEV2 parse this string into a hashmap. Use regex, 2 rows of code are enough for the job
DEV2: implemented 40 rows of switch/if cases into nested for loop.
Please kill me 🔫🔫🔫🔫🔫🔫🇮🇹3 -
*maniacal laughter*
/(?<digit>\\d)|(?<non_digit>\\D)|(?<alphanumeric>\\w)|(?<non_alphanumeric>\\W)|(?<whitespace>\\s)|(?<non_whitespace>\\S)|(?<horizontal_tab>\\t)|(?<carriage_return>\\r)|(?<linefeed>\\n)|(?<vertical_tab>\\v)|(?<form_feed>\\f)|(?<backspace>\[\\b.*?\])|(?<NUL>\\0)|(?<control_character>\\c[A-Z])/g;
... I need to sleep19 -
Related:
https://devrant.com/rants/4910402
Fought fire with fire.
I used regexes with quoting necessary regex bits inside to replace the regexes that tortured me.
Regexception.
I think I need a lot of pain meds.
Or why do I feel pain and numb at the same time?6 -
That moment when you're doing regex to parse regex expression stored in a file whose name you found using a regex on input. Regex-ception1
-
One of my classmates was working on a login form, and the fucker handtyped a 100+ character email validation regex but forgot to add a check to make sure no fields were blank.
It was funny when I was able to create an account with no username, breaking his website, and even funnier when I told him html forms have a built-in email pattern5 -
I found a chrome addon that allows me to search webpages with regex. I've had it for a full minute and I already love it.
https://chrome.google.com/webstore/...1 -
As a community of devs I really feel our search feature should have a Regex option...
I don't see all that much point to having it but still... -
So I have to fix this motherfucking insane regex with over 1k chars in it ...
This fucking shit is not maintainable and there are no comments or any other sort of documentation.
And this bullshit was not build via code so that bastard wasted weeks of time to develop that shitty expression by hand on a online regex tester website.
So I have 3 options:
1. Reverse engineer everything and waste my precious time
2. Delete that shit, analyze the input and write the regex via code instead of creating it by hand
3. Look for that "super duper clever" dev and break his legs.
I think option 3 suits me best.
And for you dear reader, if you are regexphile, enjoy this gigantc regex with >16k chars:
http://madore.org/~david/weblog/...7 -
After more than 24 years in dev, I still don't use RegEx and I have no idea how to write one without using an online builder.
I also refuse any Pull requests contaning regEx..24 -
Fun fact: Did you know this is the RFC822 compliant regex for matching email adresses? http://ex-parrot.com/~pdw/...6
-
Slowly getting better with RegEx problems! Warning, lots of non-computer linguistic geekiness ahead.
Been working on some functions recently to replicate the furigana (Chinese character annotation) functions available over at JP.SE in PHP for a project.
Managed to get the basic cases down fairly quick:
[Chinese character][reading] => <ruby><rb>Chinese Character</rb><rt>Reading</rt></ruby>
However I realized this evening that there are patterns where this repeats twice for one word, such as the following:
[Chinese Character][helper Japanese character(s)][Chinese Character][possibly optional word ending][reading for the whole thing]
Managed to get it working for both cases initially, but then I found out that adding a Japanese character to either of my test strings (see graphic) would cause the annotations to fall grossly out of sync. The next two hours disappeared pretty fast before discovering that the issue was that I was removing the wrong string length from the annotation string, and just happened to luck out with a test case where it worked the first time.
Probably going to do a code review of it with the intern next time he's in. One of the things I've been stressing to him lately is that however easy a task may be for a human, there are all kinds of extra things that need to be tracked in order for a computer to be able to follow your logic.7 -
I am in love with regex (re in py)!
It is so damn cool!
Unfortunately, Python's find is faster.
But regex is so much better when it comes to complex patterns you would not be able to find with the regular (do you see the pun here? ;)) python's string object find method.4 -
I once reviewed some code that parsed HTML using regex (red flag #1), and it turns out that it had to be done that way because the company's HTML was so malformed that no actual parser would accept it without erroring1
-
Ideas for a strong password:
- a regex matching my laptop's LAN IP address
- a sed command to enable X11 forwarding in sshd_config
- a shell oneliner extracting all the IP addresses from ifconfig / ip a sh
- an awk command to print processes in D state
-
Chip in!15 -
Came across this company when I was looking for regex for organization-ids/organization-numbers. 😂8
-
Yesterday I learned there was a chat feature in StackOverflow. I learned this because I finally for once in my life have StackOverflow reputation.
Discussing my excitement:
“Guess what topic it was.”
“Was it regex?”
“It WAS regex!”4 -
Fffffff uuuuu regex!!!! :@........
*then I finally get it working*
......I am king! And can now do anything!!!! :-D2 -
That moment when you decide to look why Vim's regex rules are a bit inconsistent and find out this program has a setting called "very magic".
Today is a good day.4 -
Spending a few hours messing around with regex and for loops to parse HTML just to SO and learn about BeautifulSoup. Why was my life wasted so!2
-
Behold the monstrosity regex my transpiler produces!
/val|var|[1-9]{1,32}|\+|\-|\*|s\/s|>>|=|;|(["'])(?:(?=(\\?))\2.)*?\1|print\(|log\(|sqrt\(|input\(|strToArray\(|httpGet\(|if\(|else|{|}|s==s|s>=s|s<=s|s>s|s<s|s&&s|\|\||!|;|\(|\)|\[|\]| |\w+/gi13 -
!rant
I used to doubt the usefulness of regex, until now.
I'm new to web dev, and downloaded a sample website to make a project with, but all the sources of images came as src="images/image.jpg", and for some reason I couldn't make it work, the only way that I found that could work to me was creating a static folder inside my app folder, declaring in the start of the document a {% load static %} and referring the image source as {% static 'images/image.jpg' %} in the html file, I kinda get what this is doing, but why it's the only way that works, it's beyond me.
Great! Now I can start the development server and see the website in its full glory!!! Then I realized: I had to edit the sources of every image and every reference to css and js in 5 html files to it work properly, and come on, do all that by hand?
Then regex came to mind, never had used it, never knew how to use it properly, after some web research I found if I did a find/replace with ([a-z]\w+\/[a-z,-]+\.[a-z]+{1,2}) and {% static '$1' %}, all the work I had to do, was resumed to a single click of replace all.
Man, I love doing what I do, and I love you guys/gals, never tough I would ever find a place in which I could share this kind of thing!6 -
If you hate creating regex strings, this site makes it fun and easy:
https://regex101.com
Thought I'd share :P2 -
Got a ticket saying we need our website's record creation wizard to have better validation. No worries, just some regex, right?
Sure, regex for name entry (with the usual white person assumptions about names), and fixing the fact that it's in-page popup doesn't close on save. Or save draft. Or delete.
And also you need to apply the name regex for the fields on this page to all the previous names that the user lists.
And there's that one issue where the address history message always shows no matter what.
Oh and make sure that if they choose to ignore those validation issues then the validation message is in the notes for the record.
And fix the thing where it saves as draft instead of as a normal record.
And and and and and...
Can we just talk about making it 1 problem per ticket? This sort of shit makes me look bad when it takes me a week to fix 1 ticket, when I'm usually a few-a-day kinda person5 -
Regex of doom!!
"It appears that you need exactly 7579 characters to pattern match every possible legal url out there."
http://terminally-incoherent.com/bl...3 -
For some reason the backend kept throwing errors when I tried to save a long string containing markdown. Initially I assumed I must be escaping things incorrectly but that all looked fine. Asked the backend guy to take a look.
Turned out that in order to count the number of words they were using a regex, which seems fine, unless you construct the regex out of my string and run that over the word count regex... 🤔 -
Man, people have the weirdest fetishes for using the most unreadable acrobatic shell garbage you have ever seen.
Some StackOverflow answers are hilarious, like the question could be something like "how do I capture regex groups and put them in a variable array?".
The answer would be some multiline command using every goddamn character possible, no indentation, no spaces to make sense of the pieces.
Regex in unix is an unholy mess. You have sed (with its modes), awk, grep (and grep -P), egrep.
I'll take js regex anytime of the day.
And everytime you need to do one simple single goddamn thing, each time it's a different broken ass syntax.
The resulting command that you end up picking is something that you'll probably forget in the next hour.
I like a good challenge, but readability is important too.
Or maybe I have very rudimentary shell skills.5 -
I had to write a script to clean some crap from a database.
In particular it had some records containing multiple names and I had to split them.
It was really a nightmare because the separator was not always the same, e.g. "John, Mark and Bob" or "Alice+Mary".
«Ok, let's use a fucking regex: ",|(and)|\\+|/|&"»
Then, I realized there were some "Alessandro" in the database. Yeah, Aless(and)ro. Shit.
So I had eventually added more crap into the database.6 -
Yes, a plus, i.e. `+`, is a fucking valid char for an email address.
Your online service is shit, you don't know your craft, and you should feel bad about yourself!
But you thought email is fucking simple, google for email validation regex and took copy pasted the first fucking find from some random blog that validates anything but an actual fucking valid email addresses, didn't you!?
(Funfact, the plus sign allow to create email aliases in some free mailer services. GMail for instance. That's why I l like using emails like my.actual.mail+I_KNOW_WHY_YOU_ARE_SENDING_SPAM@gmail.com as my registration email. Also, brute-force that login email.)3 -
Anyone knows why I can copy paste text with color??
OS: Android 6.0.1
BTW: It's a regex for searching frequently repeating duplicates. Have been trying this for a while but still not working perfect...6 -
well if the otakus of the Devrant-verse reads this, they get free updoots
(Hint: It's a Love Live Sunshine Character)1 -
If you were to write a regular expression to match phone numbers in the format of either:
(123) 456-7890 or
123-456-7890
Would you prefer a regular expression that looked like:
A) /^(?:\(\d{3}\) |\d{3}-)\d{3}-\d{4}$/g
B) ^\(\d{3}\) \d{3}-\d{4}$|^\d{3}-\d{3}-\d{4}$/g
C) Other
D) I hate regex
Reasoning? Alternative? Discuss.
(I'm curious about preferences surrounding the readability of regular expressions)19 -
You can solve a lot of problems with regex... but you can also create others if you're not careful:
"inadvertently blocked or throttled all domains containing the string t.co rather than blocking only the domain t.co itself"
https://arstechnica.com/information... -
Time math is one of the most headache inducing parts of any programming project. I'd rather deal with uncommented recursion and regex.8
-
>Gets assigned to this private Game server's project
>Boss wants me to improve the anti advertisement chat
> k
> Looks at old code
> Code is replacing unicode characters to latin ones that look similar which are being used for advertising
> lol'd who tf developed this
> regex101, building a regex query with endless of possibilities (would look something like this) /((L|\|_|I_)(O|0|\[\]|\(\))(L|\|_|_))/gi to detect lol
> Adds alot of similar looking unicode characters to assure that it will find something
> Works really well in the dev version
> Server open hour
> 30 players
> All chat at the same time
> CPU 100%
> BOSS NEVER TOLD ME TO MAKE IT EFFICIENT1 -
"In a closed society where everybody is guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity."
― Hunter S. Thompson -
TFW looking at the regex for the password validation is easier than trying to decipher wtf they want16
-
contemplating making this really simple regex stop matching dates after year 2999 just cause I think it might be funny and ruin someone's day for a few minutes long after I'm dead.16
-
Today was not my sharpest day but managed to sit eight hours on this chair with a laptop on my arm leaning. It's very comfortable.
I made a regex interpreter. Three versions, the first one was nicely programmed and functional but found out that it was 16 times slower than the clib one (at least!). Then i found out how extremely fast the clib one was and found out that the compiling to bytecode what they do is extremely effective. So, i've wrote my one bytecode compiler that is faster than theirs. So, the second version was born. After abusing that thing to find out what kinda speeds i could get out of it, it became very unmaintainable, beyond resque. So i made third version, this one is very performant. It supports [abc]{3} (three times dupplicating group) for example. It supports 0-9 and a-z that converts to 'd' and 'a' (shorter for speed). It converts [a0-9a-z]]{3} to [lada][lada][lada]. The bytecode is not smaller many times than source, but not having to think, suits the interpreter very well. It's blazing fast.
I wish I could smth like this for a living. Develop a language for a living or socket servers. Tired of python (great language, but boring).
Thanks for listening to my tedtalk6 -
I thought I had a great understanding of regular expressions but today I tried to use them in vim... Why the fuck they have to be so different there??4
-
Started new course called "Introduction to natural language processing" in uni. I am super bad at doing regular expressions and don't understand anything about them.
Saw the first weeks homework. Have to do i.e. some text cleanup with regex... I was sad. But now after reading the course material and trying some of the exercises I'm super excited since I'm actually doing something "real" with it.
Do you guys just love it when teaching material is well written? I do.3 -
Tomorrow are is my final exam in english (I'm a german).
So what did I do today?
Learning...? A bit.
RegEx...? Heck yea!9 -
Finding out how not to do it.
An example, learning how to parse HTML, and finding a stackoverflow post with the answer "use regex" triggers tech junkies so much that they actually comment a mostly accepted way of doing something.3 -
That great feeling you get when your teacher asks you some things about RegEx and you know fucking everything!2
-
Is it even possible to get good enough at regular expressions where you can just write it and you don't have to search stackoverflow for one that works?9
-
I was genuinely baffled by this until I read up more on regex flags and realised that this is the intended behaviour😂13
-
!rant
@dfox How do you feel about an update to the profile page? I want to link to my personal website, perhaps some regex black magic to override the github link if it matches a URL?
Or just a new input?7 -
What are you doing crashing on me Windows?
All I was doing was running a flight simulation, compiling a build, and doing a regex search over 6 directories. Try to open one little document and it all goes to hell.
Surely you can handle that Windows?
Apparently not.2 -
Awful idea of the day - Have a programming language with no comments, but regex preprocessor macros. Use macros to define your own comment syntax and strip them before compiling.
#define /\/\/.*//1 -
Restarting regular expression parser from scratch has been good. I am somehow both much farther to completion and farther away from completion than I was in the earlier implementation.
Further in the sense that this implementation is going to be way more flexible to changes in the language
Farther in that I haven’t even got all of the regex parts added to the first stage yet.
But I’m feeing good about it.
Even if I did refactor it so my constants are in all caps and now feel like my core is yelling at me.11 -
Regex syntax and vocabulary when talking about it reminds me of what Scientology would look like if it had its own coding language.3
-
two things people think they are good at, but actually have no clue about:
regex and sex
[I just needed an excuse to write a post about those two, since they sound really nice to each other :D ]7 -
Never understood the hate for regular expressions, it's just one more useful tool in my eyes. Anyone want to weigh in?9
-
I fucking hate css. This animation is a fucking dirty hack on top of a dirty hack on top of a selector that looks like regex that only works in chrome
Fuck me8 -
This regular expression documentation thing is coming along. Added capture groups and backreferences. Think I just need to tackle Unicode property escapes and control characters.
But now I feel like I should have implemented it differently. Like, maybe instead of “‘a’ followed by ‘b’ followed by ‘c’, I should have just done ‘abc’.
*sigh*1 -
when you have to validate an email address to fit the requirements of some stupid mail software
(^$|^([^<>()\[\].,;:\s@!&#$%+'{}|~*="]+(\.?[^<>()\[\].,;:\s@!&#$%'{}|~*="]+)*))@((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|(([a-zA-Z\-0-9]+.)+[a-zA-Z]{2,})$)
I'm not even sorry.6 -
Let me guess, using regexes in the mousemove event handler isn't a great idea.
How fast are simple regexes, anyway?
I have /^(\d+)(.*)$/, because I want to animate a css property that might have some unit.15 -
Maybe not so wk65
but nobody posts a awesome regular expression?
come on, it says "exp."
someone gotta write one!
(not me, i suck with regex)1 -
There's two types of people in this world, those who don't like regex, and magical otherworldly beings, luckily for me, I'm the latter
-
Inherited a codebase that implements its own word wrapping for receipt printing. Problem is it's putting an extra space at the end of each line.
I open up the implementation, expecting it to be a relatively simple fix, until I see this…
var regex = '.{1,' +width+ '}(\\s|$)' + (cut ? '|.{' +width+ '}|.+$' : '|\\S+?(\\s|$)');
return str.match(RegExp(regex, 'g')).join(linebreak);undefined looks like i'm writing a word wrap readability shmeadability regex look ma only two lines!7 -
!rant
I don't want to seem like a huge noob and a douche... but I spent like 5 hours the other day working on a bash script prompting you if you want to delete each individual user on the system (keep in mind that I'm fairly new to bash) and when I got the code correct... holy shit... I felt like a fucking god.1 -
First case of Coronavirus in my Country 🇬🇭. This is going to be a tough one since customary, we greet by shaking hands and our public transportation system...6
-
Finished my regex validator. But now the edgy stuff kept coming. It seems that you can do a-d or 3-8. OK, makes sense (else it would be just copies of \w and \d), but anyone ever saw someone using it? I only knew a-z and 0-9.
Thing is, I wrote the perfect design now for the interpreter. Adding features is easy now and not so exciting.
Still, I have a big plan for it that makes it possible to validate nests like (()) or {{"}"}} or anything you see as start / close tag while keeping regex generic. I'm not learning it that signs between some chars ("') has special rules. That would be specialization.
Fun fact: my regex is six times slower than native C code (not c regex) validating the same. In half of test cases faster than c regex. I consider it a success.
Thanks for listening8 -
The worst thing is to spend hours wondering why a regex isn't getting the right values. Then I edit the regex and when I used undo on my changes, all of a sudden it worked. No idea why...
-
Today I‘ve been investigating a freeze in our app. It took me many hours to narrow it down to the textfield validation regex. And it turned out to be a "catastrophic backtracking" issue.
I‘m a regex noob so I don‘t have a clue how it occurs exactly. But I‘m a bit perplexed about what a seemingly innocent regex can cause.
For me it became another argument against regex now.
I‘ve rewritten the regex into readable code and the freeze is gone.
I could try to fix the regex but… nah. The code is better anyway.7 -
Those tiny find and replace dialogs drive me nuts. I had to use a plugin for Notepad++ to get one that supports regex and RESIZING THE FING WINDOW...sorry gvim, you're regex is strong but your gui is weak.
-
Pretty recent one. I found that I can use Perl to edit files using a single cmd line (with regex search and replace). Loved it.
-
Sometimes, I feel like tearing my hair out from the way Bash works.
Like... Where other languages have two operators for case-sensitive and insensitive regex matching, bash? It doesn't. It only matches case-sensitively.
And if one wants the insensitive matching? Gotta set a shell option... And if a script wouldn't change it back, who knows what else could break, so of course it has to save its initial state, change it, do its case-insensitive matching, and return it back to its original value.
10/10 experience.14 -
https://stackoverflow.com/questions...
I'm quite tempted to tell him to implement everything static in Python and get this one maybe non-static string using RegEx, but I don't want to lose any more reputation. D:1 -
Ugh! Anyone also finds it incredibly annoying that regex notations can change between programs? And I don't mean like PCRE vs jS, those are functional differences.
I mean like... In sed, I always spend trying out all possible combos of backspacing when dealing with special notations like quantifiers {}, sets [], match groups () and so on!
Why can't it be just so that backslash anything = character literal, and not the functional counterpart.
Or at least stick to either one of the options, not like sed, where matchgroup is \(\), quantifier \{\} but a set is just []
Also wish sed supported reluctant quantifier (*?), having to use negative character set matching makes it much less readable...3 -
"What do you mean I can't use a regex object as the key in a hashmap??
...ok, you know, now that I actually said it out loud"3 -
To all websites requiring at least one upper case, one lower case, one number, one special character, 25 emoji and 49 unicorns in the password when signing up.
If you say something is required, then your regex BETTER be checking ONLY for those things. You should not have hidden requirements for passwords that users are supposed to dream about and know. Especially if it's a super time-sensitive thing that they should have opened 2 Fridays ago.
I had to pull my hair out for 20 minutes (that felt like an hour) before looking at their code and reading their regex. The regex was different from what the page said the requirements actually were. What were they even thinking? 😑
The rest of everything related to this organization uses an SSO system, why can't they just use it? Isn't the whole point of SSO to avoid a different login for every tiny part of the system?
I wonder what the other less technically inclined people using the system are doing right now. Sadly, I have no way of letting them know.
I sincerely hope the dev that made that website faces the same thing while picking a password for creating an account somewhere else and realizes what he/she did.
I really needed to let it out.
I feel much better now.
Time to take out the stress ball :)1 -
Current work in progress: https://whimsical.com/regular-expre...
Though I’ll warn you, if you’re on mobile, it’s going to look suspiciously like a blank page. It’s not. Just.... requires a lot of scrolling. 😅4 -
REPOST (since people focused on an unescaped dot rather than on the problem matter).
Has anyone noticed how bad javascript's regex is?
21st century and it still doesn't return capture groups with separate indexes.
regex.exec and str.match doesn't return them either.1 -
Sudo apt-get install -y php7.1
E: unable to locate package php7.0
E: couldn't find any package by regex php7.12 -
Just want to take a moment to thank Sir Francis Regex (AKA Stephen Kleene) for creating regex. Thank you for making my life easier and better through your efforts. Rest in peace, my friend.
Regex is the shit y'all. We all stand atop the shoulders of giants. Spare a moment to reflect and appreciate. -
Yesterday I took the evening to set up a backup server on my home NAS, so I could finally backup my dualboot laptop. Today I came home from work, boot up the laptop to configure the clients.... This happen, fucking black screen and doesn't even boot! Fuck fuck fuuuuuuck!!!4
-
I see bad data and thought to myself, "I'll be able to fix this with a simple regex." A month later, I'm still finding new data patterns. Never give users the ability to store all of their data in a huge textarea box where they can make stuff up.2
-
Fuck I hate when my brain remembers the wrong keyword! Just spent way too long trying to figure out why my regex wasn’t working! I remember RegEx.check(str) tests for a match and returns a Boolean. The docs say RegEx.test(str) checks for a match and returns a Boolean! Dammed cinnamons! English is my native language I swear.2
-
I thought JavaScript was a poorly designed language. Then I found out its regex don't even have named capture groups.2
-
Writes regex pattern at regex101.com: match
Writes same pattern on site: No matches
Trying to fetch text from foreign site to detect when the text changes. -
Creating a webscraper using regex because there's no API available, knowing it will break the moment the source changes its markup.2
-
My biggest pet peeve is that too many developers don't realize that "regex != regular expressions", probably because of bad naming and bad documentation. It's easy to assume that they're the same, but most regex syntaxes today are actually at least context-free grammars, since they support backreferences.7
-
The script I inherited uses REGEX to verify certain table fields are properly formatted as numbers... even though the fields in question are NUMBER-type fields!! :-/
-
Every once in a while I come across a challenge that's actually challenging. Most recently ... "Develop Regex for validating and extracting a recipe's ingredient's quantity"
Regex should properly identify the numbers in each of the following lines:
1 cup of ingredient
Diced 1/2 cup of ingredient
.5 tsp of ingredient
1 1/2 packed cup of ingredient
1.5 cup of Heavy whipping cream
My answer is the first comment in case you want to solve it yourself. I'd love to know what others come up with.5 -
I was tasked to parse some complex output oft another application so that it can be displayed nicely in our Frontend. The output had lots of inconsistencies and exceptions - I spent the entire fucking day to wrote the craziest regex I have ever written in my entire life. With a few minor issues it worked pretty well. I was happy... Then a colleague came into my room, peeked into my screen..
Him: "You are aware you can just specify a --json flag to get json output?"
Me: "..."
*long silence*
Me: 😵🔨
Please end my life.1 -
When I wrote a templating engine (great overstatement) just for myself to learn, I had this bug in php5 and regex that would crash the whole apache server.
Literally nothing worked and I didn't know why. After rebuilding everything I tried with regex using only simple string manipulation all of a sudden everything worked fine. -
How can I be pro at string/json manipulations/regex etc?
I really suck at it and it really impacts my performance.3 -
Used the java replace method to remove specific characters with a regex. Wondered, why the characters weren't replaced until I realized I forgot that replace doesn't use regex but matches literally. Checked my previous code snippets, whether I made that mistake previously ... nope, I used replaceAll. 🤦2
-
Found this in a shell script. Instead of just one regex, why not use grep and sed, even though you could have just done it all with sed!
IMAGE_TAG=`grep defproject project.clj | sed -e 's/^.* \"//' -e 's/\"//'`2 -
Arghhhhh working with regular expressions (already a bad start) got it working on my dev PC but it won't work on the server.
The only difference is my pc is running PCRE v8.41 and my server is running v8.42. Can't find anyone else having the same issue on SO/Google8 -
Team member takes names inputted and coverts them to slugs, works perfectly and functions extremely well.
Adds function to allow slug modifications but doesn't use regex or anything else to verify input is a real slug, application goes down over weekend and know one notices till this morning...
Always verify input both client and server side!!! -
Please use re.VERBOSE for regexps and add comments. They help a lot to understand this Pile of symbolic crap.
-
Some people, when confronted with a problem, think “I know, I’ll use regular expressions!”
…and now they have two problems. 🤦♂️🤷♂️6 -
The fact that i no longer have to bother knowing or googling about generic java classes, lambda expression, regex, SQL syntax etc, and just ask ChatGPT to show me a code example of it - blows my fucking brain off2
-
When writing regexes why the fuck would you not use \w instead of writing [a-zA-Z0-9] or \d instead of [0-9] or the dozen other metacharacters? Makes it so fucking hard to decrypt long regexes.2
-
My regex foo has gotten really weak. It took me unholy number of attempts to get ^\n{1,}$ right 😞.1
-
More like a confession.
Had a task that involved invalidating a string if it contained more than five digits (anywhere in the string.)
"No problem", I thought. That sounds like a simple regex!
^(\D*\d?\D*){5}$
Turns out catastrophic backtracking had other ideas, and I revert to my usual "atomic grouping fudge that will hopefully work without me really understanding what's going on" of:
^(?>\D*\d?\D*){5}$
...anyone else shamefully follow this mantra, or am I the only one that hasn't skilled up properly on regexes...7 -
My manager and coworkers kept calling me during vacation to add more triggers to fire some functionality. I had enough and made a regular expression matching, told them to learn regex and fuck off
-
I'm growing tired of having to wait sometimes minutes to make searches in large text files (about 5 MB), especially with regex...
Any tips on good addon for Sublime Text or other text editor?12 -
Given that an XML parser probably/should uses a regex to find the beginning ("<--") and end ("-->") of a comment, WTF can I not use "--" inside one?7
-
RegEx
i.e. be able to see a text and compose Re for it and vice versa, get a text and Re and see if they match... -
The first thing i have done in 2018 was correcting backup scripts at 5am cause of overflow disks.
Now the regex matchs 2018 😅1 -
So first you said that the id's wouldn't change and now they do,
Wtf, guys c'mon
But if you look at the bright sight I can now play with regex again
🙃 -
Not really most painful, but definitely most painful of the recent bunch..
// yup, a bunch.. I've managed to fuck up a little on every thing I did that day :/ little friday the 13th for me, especially as I went on sick leave the next day and had to fixup my fuckups with a friggin migrane..
Anyways, I was fixing fallback to some default value in plsql.. before it didn't check what the input format was and simply relied on certain format, parsed that and converted to number..threw an error, duh!
I fixed it somehow elegantly to check with regex if the format is as expected and if not default to xy value..and if format is as expected to parse out the number..except that when I copied (or typed?! for the sake of me, I cannot recall how the fuck I managed to fuck this up) over the code to the package I didn't see additional [ at the begining, so everything went to the default.. Most embarrassing part is I commented everything, how it should work, use cases, what the input was and what was expected output..and failed to see the friggin extra [..
It was fixed easily, the extra [ stood out later when I saw the code, but it bothers me how I managed to overlook that in the first place. I think I need a vacation.. but have to fix other fuckups first.. :/ -
I kinda hate that I don't get any use out regex at work (I work with integrations). Gotta love that feeling when something that would have taken 10+ lines to solve without regex can be solved on 1 line with.3
-
Okay, I'm learning XSD (I wish i didn't, but yeah)
Why the fuck does it require so much code to use the simplest regex?
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:pattern value="([0-9])*" />
</xsd:restriction>
</xsd:simpleType> -
I recently got an assignment of converting 600+ PHP 5.6 files to PHP 7, where I also have to update to different coding conventions *sigh*
I then later found out about regex, and regex search in atom.io :D I'm now strongly considering making a converter, that goes after my clients spec, does any of you have experience with that?2 -
Trying to craft a capturing subtraction group without having a good grasp of regex... That's a bad practice, right?1
-
I created a regex which works locally but not on a remote installation with the same php version.
I am confused… very confused17 -
So, next monday I will be starting a new project in my company, the very first I have to manage as a sort of project owner in addition to my usual develer rolem. I will be asked to manage the relationship with the customer and all' the details, issues et cetera. Well, I dont know if I am ready and I tought to ask here some advices. So, what do you experienced developers suggest to a fresh meat? (2 years experience pro it world)
-
Literally wasting a good cyberpunk mix.
I'm trying to extract and replace values in a string with regex [C (POSIX)] and listening to a really good mix during this.
I'm leaving the link here in case anyone wants to check it out.
https://youtube.com/watch/... -
When your apprentice keeps offering to write regex when all you need is a simple trim(), you know he's outgrown you.1
-
Stupid Nhibernate! Half day to get a domain configuration barely working! I hate you.
P.s.
Someone know some resource to learn about Nibernate by the code? It seems awesome and I'm a noob. -
SambaCry: This Linux Malware Is Turning Machines Into CryptoCurrency Miners
https://fossbytes.com/sambacry-malw... -
What will be the regex to include all words concatenated with special characters but exclude whitespaces12
-
Its one thing to store all text data of an address into a single database field. Its another where data is so hard to capture with regex because fuck patterns and consistency.
-
This startup contracted me to develop an app for them. They gave me the mockups and said they need it in 7 weeks. Two apps in 7 weeks, no problemo. Almost done with the first app then they came saying they are changing everything. How can you decide to change your entire app and concept mid development? You haven’t even tested the market to know whether your idea holds.3
-
So I've just updated a chrome extension on an android tablet, with regex from my bed, also got said chrome extension running on said tablet...
Technology is getting good