49
webnoob
7y

Man. Fuck RegEx.

Comments
  • 19
    I fucking love regex. I love it so much that I have an android app of regex's crosswords
  • 0
    @Floydian It allows you for creating basic patterns for matching/splitting or extracting strings against/on/out of strings. Very useful and mostly easy to write but sometimes hard to read.
  • 0
    @Floydian regex is short for regular expression, as you said. It is a way to match a String, meaning you can figure out if the String has a desired format, without knowing the content of said String. I.E. you get a user input and you want to make sure they didn't start with a number and didn't use special characters, you can say that with regex (Don't ask me how though, regex is really hard!)
  • 0
    @Floydian – The only use case I've ever come across for RegEx is for parsing sections of strings that follow a pattern defined by the dev (e.g., if a phonebook existed as a single string of names and numbers, RegEx could help you parse out these names and numbers to be more easily manipulated for later).

    The hardest part for noobs like myself is being the dev that comes up with a pattern that doesn't suck. And today, I'm sucking at RegEx.
  • 2
    @webnoob we have a web app where you can perform queries against some data, something like:
    column=value AND column2=value2

    And endless combinations, we had to write a regex test to check if it is ok on the client side.

    Its pretty cool, I love regex.
  • 1
    It's not that bad.
    I used to feel the same way. But one day i just decided i want to learn it and spent the whole day reading tuts, making notes, doing examples and re reading my notes.
    Make the investment. Just one day.
  • 0
    @dgfz I don't have a whole free day to learn regex..... Im just gonna keep looking for my regex strings on stackowerflow...
  • 0
    @Floydian regex is useful if you want for example: find all the words that start with letter 't' and finish with 'h' or some specific number format, postcode.
  • 1
    I have a love/hate relationship with it, but I'm mostly just doing it wrong when I hate it, and found a solution when I love it... (:
  • 1
    i had this problem to search for a given 2d array in another 2d array ..regex saved the day
  • 1
    Without regex, I'd still be typing something I started in 2007.
  • 1
    In Mother Russia, RegEx fucks you!
  • 2
    The words of a true n00b.
  • 0
    RegEx are great, but fucking annoying... Especially when tou have to create a regex to validate a date... :D
  • 0
    @Floydian

    Regex is a pattern like:
    ^#?([a-f0-9]{6}|[a-f0-9]{3})$

    which says:
    ^ start of the line
    #? maybe an octothorpe?
    () store this stuff for later
    [] anything inside of this is fine
    a-f0-9 hexadecimals ftw!
    {6} the thing before repeats this often
    | or... it could also be {3} hexadecimals
    $ end of the line!

    So the above matches #000, 32127a, and #0055cc, and returns the numbers inside of it.

    1. Yes, this is powerful. You can match, check and extract parts of texts in pretty advances ways. Regexes are awesome to give instant validation feedback in web forms, to search and replace in an IDE, or filter important fields from a file.

    2. Yes, it's complicated and fragile. Regex can give false results. People get lost, writing monster-regexes to validate html snippets or email accounts, because those are not very "regular" (http://ex-parrot.com/~pdw/...).

    I love puzzling out good/simple regexes, but without regex101.com I would have turned insane by now.
  • 0
  • 1
    @lurker I think you mean the opposite.
  • 0
    @ChuvaS and what's that?
  • 0
    $_ ~= s/Fuck/Love/;
  • 0
  • 1
    @bahua you're right, I don't practice perl from years
Add Comment