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 - "regexp"
-
My boss said something genius today: "understanding client's wishes is like writing a regexp for everything they say"😂5
-
FML
B: boss
M: me
B "Do this work (basically a document parser) "
A "Done using regexp"
B "The data coming in is different now"
A "ok, updated the regexp parts to account for this"
B "hmm, I you should rewrite it using library tool coworker made"
A "eeer ok, redone all the work now but it's a little hacky"
B "oh, library tool isn't flexible enough. Hmmm maybe use regexp?"
A - literally dead4 -
When you forget to uncheck the "RegExp" button in the "find and replace" dialog, and it's too late to undo your changes.8
-
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
-
Hmmm, this feature that I added seems to make the whole process 50% longer. I need to optimize something. Let's see now...
Yeah, make that a shared resource and parallelize IO to leverage the multi-core architecture. Hash map for this, binary tree for that. This thing that gets called a million times can be written easily without a regexp. That thing can be rewritten in Rust as it's too demanding.
There! Works! And it's also a lot cleaner. Nice!
How's the performance doing? 70% longer.11 -
Client: How long will it take you to build this?
Me: Maximum of 7days
Day 1 to Day 5, To myself: I have so much time, lemme build a Js engine in Rust and open-source it. It shouldn't take that long.
Day 6, After many failed attempts at debugging RegExp:
Starts working on the client's product, scraps off sleeping hour (why do I sleep in the first place)
Day 7: At 23:59...calls clients, he doesn't answer, probably sleeping... Sends message "Product ready to be tested at your call, I've not slept in 7 straight days because I like you"4 -
For when I need to make a website awesome:
javascript:var a='hotPink',b='pink',h=document,i=h.body,c=function(d,e){f=h.getElementsByTagName('*');for(g in f){f[g].style.background=d;f[g].style.color=e;}};i.innerHTML='<marquee behavior="scroll" direction="left" scrollamount="30">'+i.innerHTML+'</marquee>';(function(){function htmlreplace(a,b,element){if(!element)element=document.body;var nodes=element.childNodes;for(var n=0;n<nodes.length;n++){if(nodes[n].nodeType==Node.TEXT_NODE){var r=new RegExp(a,'g');nodes[n].textContent=nodes[n].textContent.replace(r,b);}else{htmlreplace(a,b,nodes[n]);}}}htmlreplace("a|e|i|o|u",'o');htmlreplace("A|E|I|O|U",'O');})();c(a,b);4 -
Our invoice report crushed because someone paste an invalid character which devExpress couldn’t handle.
I told boss we should trim and run regexp test for all string input.
Got rejected.
Why?!?!?!🧟♀️🧟♂️🧟♀️ 🧟♂️3 -
Regex are one of the finest art piece in software.
Had a 2 hour class and even after that I think you can spend months on mastering it.
It's not something I haven't used but we undermine whole beauty of how random characters can form formula and extract complicated pattern.
Kleene we owe you.2 -
So the guy who i mentioned previously with his shitty csv made webservice which i needed to use.
It returned utf-8 encoded xml:
- in file the header contained central europe encoding
- the xml had more roots
- basically he only put his csv format inside xml tags
- csv contained html tags but there wasnt cdata
Now work with this lol
I neded to cut this shit with string functions and also some numeric data get with regexp from htm table td's
Whyyyyyyyyyyyy1 -
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 -
Javascript I'm trying to love you I really do.
But what did Webpack do to my named capture groups?3 -
Me: Let's create a project!
* writes initial code *
Homework: Fuck you, complete me first.
* completes homework *
Me: Let's push it to GitHub and NPM!
School: You will do that tommorow's afternoon, now go to shower.
* writes this rant *
btw a project is upcoming, it's not a web app, but it has regexp -
!rant Spent days reading Unicode docs, trying to make sense of what codepoints were included in every Unicode property escape in JavaScript and awk’ing the heck out of the different text files associated with them.
Then at around midnight the other night, it came to me. I was an idiot.
I could literally just create an array including every Unicode codepoint and write a program to iterate through the array and test if it matched against a Unicode property escape.
Unicode array: https://gist.github.com/AmyShackles...
Program to compare against Unicode property escape: https://gist.github.com/AmyShackles...
So. Much. Easier.
Happy 2024, friends. -
I need to build a dynamic regular expression with matching 0 or more char, but \w doesn’t work.
new RegExp(‘^\/\w*#’ + route, ‘i’)
Any solution? 🥺14 -
I wanted to get the latest NASA APOD photo with Python. Easy, right? Nope! Firstly, their RSS feed is partly HTML, so feedparser doesn't understand it. Secondly, feedparser doesn't even get the titles of entries correctly.
Which is why I'm trying to parse it in a horrible way using Python regexp. NASA can put humans on Luna but not even get their RSS feeds to parse properly.2 -
Please use re.VERBOSE for regexps and add comments. They help a lot to understand this Pile of symbolic crap.
-
How do I go into tokenizing strings of text from a LaTeX file into a Go structure for further processing? I feel like splitting hair trying for loop over an io.Reader and using regexp to find where a sentence ends; there must be a better way...2