Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. I love regular expressions

I love regular expressions

Scheduled Pinned Locked Moved The Lounge
designcomgraphicsiot
83 Posts 36 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T trønderen

    If you give programmers super-compact notation, such as APL, they scream in horror: That is unreadable cryptic! If you give them readable regular expressions, such as in SNOBOL, they scream in horror: That takes at least twice as many keystrokes! The rule is simple: If we have learned the cryptics, it is excellent. Otherwise it is detestable. Obligatory URL: Geek&Poke: Yesterday's regex[^]

    H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #9

    I don't understand why it's difficult - DFA at least. DFA is () [] * + . | That's not a whole lot to master.

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    N P U 3 Replies Last reply
    0
    • M Mike Hankey

      COBOL?

      As the aircraft designer said, "Simplicate and add lightness". PartsBin an Electronics Part Organizer - Release Version 1.3.0 JaxCoder.com Latest Article: SimpleWizardUpdate

      J Offline
      J Offline
      jmaida
      wrote on last edited by
      #10

      :) close cobol brings back a lot programming memories

      "A little time, a little trouble, your better day" Badfinger

      D M B 3 Replies Last reply
      0
      • H honey the codewitch

        At least the non-backtracking subset. DFA regular expressions. - they are a compact way to describe a simple syntax - they are plain text and brief, easily communicatable and transferable - they are cross platform (at least DFA), running in most any engine - they are incredibly efficient (again, DFA) - they are versatile, able to do validation, tokenization, and matching as well That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language. Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above. I know some people hate them, and I can understand that. But show me a better way.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        S Offline
        S Offline
        StarNamer work
        wrote on last edited by
        #11

        RegExes are like any other tool/language. Great if you've learned how to use it, otherwise you're likely to get annoyed. Many people here probably touch type, but the first time you used a keyboard you possibly thought "why can't they just put the letters in alphabetical order so they're easy to find?" :)

        M 1 Reply Last reply
        0
        • M Mike Hankey

          COBOL?

          As the aircraft designer said, "Simplicate and add lightness". PartsBin an Electronics Part Organizer - Release Version 1.3.0 JaxCoder.com Latest Article: SimpleWizardUpdate

          J Offline
          J Offline
          jmaida
          wrote on last edited by
          #12

          need regex to natural language and vice versa

          "A little time, a little trouble, your better day" Badfinger

          T 1 Reply Last reply
          0
          • S StarNamer work

            RegExes are like any other tool/language. Great if you've learned how to use it, otherwise you're likely to get annoyed. Many people here probably touch type, but the first time you used a keyboard you possibly thought "why can't they just put the letters in alphabetical order so they're easy to find?" :)

            M Offline
            M Offline
            Mircea Neacsu
            wrote on last edited by
            #13

            StarNamer@work wrote:

            "why can't they just put the letters in alphabetical order so they're easy to find?"

            A better question is "why are we so enslaved to tradition that we keep using a layout optimized for the Remington No 2 mechanical typewriter over 100 years ago?" And, please, don't get me started on the sexagesimal system used for time and degrees! :D

            Mircea

            P J 2 Replies Last reply
            0
            • H honey the codewitch

              At least the non-backtracking subset. DFA regular expressions. - they are a compact way to describe a simple syntax - they are plain text and brief, easily communicatable and transferable - they are cross platform (at least DFA), running in most any engine - they are incredibly efficient (again, DFA) - they are versatile, able to do validation, tokenization, and matching as well That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language. Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above. I know some people hate them, and I can understand that. But show me a better way.

              Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

              K Offline
              K Offline
              Kenneth Haugland
              wrote on last edited by
              #14

              Stay away from the vodka!!! Clinton Yeltsin disaster - YouTube[^] :laugh: I do like regular expressions too. But they often turn out to be very complicated to read and error-check.

              P 1 Reply Last reply
              0
              • J jmaida

                how about natural language to regex translator? such a thing? i am checking.

                "A little time, a little trouble, your better day" Badfinger

                G Offline
                G Offline
                GuyThiebaut
                wrote on last edited by
                #15

                I used ChatGPT precisely for that and it returned a decent regex with an explanation. I needed to word my question in a manner that was generic but the result was actually helpful.

                “That which can be asserted without evidence, can be dismissed without evidence.”

                ― Christopher Hitchens

                J 1 Reply Last reply
                0
                • H honey the codewitch

                  I don't understand why it's difficult - DFA at least. DFA is () [] * + . | That's not a whole lot to master.

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  N Offline
                  N Offline
                  Nelek
                  wrote on last edited by
                  #16

                  Only because there are few operators it doesn't mean it is easy. Binary is only 0 and 1, and look at what can be done with it. :rolleyes: :-D

                  M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                  1 Reply Last reply
                  0
                  • H honey the codewitch

                    I don't understand why it's difficult - DFA at least. DFA is () [] * + . | That's not a whole lot to master.

                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                    P Offline
                    P Offline
                    pivertt
                    wrote on last edited by
                    #17

                    Thx, learned something new today!

                    the funniest thing about this particular signature is that by the time you realise it doesn't say anything it's to late to stop reading it

                    P 1 Reply Last reply
                    0
                    • J jmaida

                      :) close cobol brings back a lot programming memories

                      "A little time, a little trouble, your better day" Badfinger

                      D Offline
                      D Offline
                      Daniel Pfeffer
                      wrote on last edited by
                      #18

                      jmaida wrote:

                      COBOL brings back a lot of programming memories

                      ... and a good therapist helped me deal with them. :)

                      Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                      1 Reply Last reply
                      0
                      • H honey the codewitch

                        At least the non-backtracking subset. DFA regular expressions. - they are a compact way to describe a simple syntax - they are plain text and brief, easily communicatable and transferable - they are cross platform (at least DFA), running in most any engine - they are incredibly efficient (again, DFA) - they are versatile, able to do validation, tokenization, and matching as well That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language. Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above. I know some people hate them, and I can understand that. But show me a better way.

                        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                        W Offline
                        W Offline
                        Wizard of Sleeves
                        wrote on last edited by
                        #19

                        Becoming fluent in regex is they first step to becoming a wizard. But a word of warning, never say them out loud, as there is a very good chance you will summon an evil demon (not daemon).

                        Nothing succeeds like a budgie without teeth. To err is human, to arr is pirate.

                        P 1 Reply Last reply
                        0
                        • R Ron Anders

                          They should be called irregular expressions. :-D

                          G Offline
                          G Offline
                          giulicard
                          wrote on last edited by
                          #20

                          Joking aside, more trivially I believe the term "regular" refers to the third level of Chomsky's hierarchy, which, precisely, is defined as Type3-Regular. DFA (Deterministic Finite Automaton) are FSA (Finite State Automaton).

                          R H 2 Replies Last reply
                          0
                          • P pivertt

                            Thx, learned something new today!

                            the funniest thing about this particular signature is that by the time you realise it doesn't say anything it's to late to stop reading it

                            P Offline
                            P Offline
                            Paul Sanders the other one
                            wrote on last edited by
                            #21

                            Love your sig 🤣🤣🤣

                            Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

                            T 1 Reply Last reply
                            0
                            • M Mircea Neacsu

                              StarNamer@work wrote:

                              "why can't they just put the letters in alphabetical order so they're easy to find?"

                              A better question is "why are we so enslaved to tradition that we keep using a layout optimized for the Remington No 2 mechanical typewriter over 100 years ago?" And, please, don't get me started on the sexagesimal system used for time and degrees! :D

                              Mircea

                              P Offline
                              P Offline
                              Paul Sanders the other one
                              wrote on last edited by
                              #22

                              Take my QWERTY keyboard away? Over my dead body!

                              Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

                              1 Reply Last reply
                              0
                              • W Wizard of Sleeves

                                Becoming fluent in regex is they first step to becoming a wizard. But a word of warning, never say them out loud, as there is a very good chance you will summon an evil demon (not daemon).

                                Nothing succeeds like a budgie without teeth. To err is human, to arr is pirate.

                                P Offline
                                P Offline
                                Paul Sanders the other one
                                wrote on last edited by
                                #23

                                So you are fluent, then.

                                Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

                                1 Reply Last reply
                                0
                                • K Kenneth Haugland

                                  Stay away from the vodka!!! Clinton Yeltsin disaster - YouTube[^] :laugh: I do like regular expressions too. But they often turn out to be very complicated to read and error-check.

                                  P Offline
                                  P Offline
                                  Paul Sanders the other one
                                  wrote on last edited by
                                  #24

                                  Too funny. Yeltsin was a good sport there.

                                  Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

                                  1 Reply Last reply
                                  0
                                  • H honey the codewitch

                                    At least the non-backtracking subset. DFA regular expressions. - they are a compact way to describe a simple syntax - they are plain text and brief, easily communicatable and transferable - they are cross platform (at least DFA), running in most any engine - they are incredibly efficient (again, DFA) - they are versatile, able to do validation, tokenization, and matching as well That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language. Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above. I know some people hate them, and I can understand that. But show me a better way.

                                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                    S Offline
                                    S Offline
                                    seismofish
                                    wrote on last edited by
                                    #25

                                    I'm absolutely with you on that. Also, with PCREs, the /x switch allows you to indent and comment to your heart's content, so you can write perfectly legible code, and there are on-line engines where you can drop your expression and your input and watch step by step while it does its magic. I'm not sure that I do a day's work without writing a regex and I know of no tool with anywhere near the power for parsing text. ~~~~~~~~ <°}}}>«<

                                    H B 2 Replies Last reply
                                    0
                                    • H honey the codewitch

                                      At least the non-backtracking subset. DFA regular expressions. - they are a compact way to describe a simple syntax - they are plain text and brief, easily communicatable and transferable - they are cross platform (at least DFA), running in most any engine - they are incredibly efficient (again, DFA) - they are versatile, able to do validation, tokenization, and matching as well That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language. Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above. I know some people hate them, and I can understand that. But show me a better way.

                                      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                      M Offline
                                      M Offline
                                      Maximilien
                                      wrote on last edited by
                                      #26

                                      The problem with regular expressions, is that most of us use them once every couple of years and we have to relearn everything from scratch every time. For someone who's doing RE everyday, it's simple; I used to have a boss that was like that; we all went to her to write/debug our RE. (and we never document the RE in the code :rolleyes: )

                                      CI/CD = Continuous Impediment/Continuous Despair

                                      H J 2 Replies Last reply
                                      0
                                      • H honey the codewitch

                                        At least the non-backtracking subset. DFA regular expressions. - they are a compact way to describe a simple syntax - they are plain text and brief, easily communicatable and transferable - they are cross platform (at least DFA), running in most any engine - they are incredibly efficient (again, DFA) - they are versatile, able to do validation, tokenization, and matching as well That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language. Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above. I know some people hate them, and I can understand that. But show me a better way.

                                        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                        C Offline
                                        C Offline
                                        Cpichols
                                        wrote on last edited by
                                        #27

                                        Since there are good regex interpreters online, I'm good with using them.

                                        1 Reply Last reply
                                        0
                                        • G giulicard

                                          Joking aside, more trivially I believe the term "regular" refers to the third level of Chomsky's hierarchy, which, precisely, is defined as Type3-Regular. DFA (Deterministic Finite Automaton) are FSA (Finite State Automaton).

                                          R Offline
                                          R Offline
                                          Ron Anders
                                          wrote on last edited by
                                          #28

                                          What the absolute ever. :-D

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups