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 1 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.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    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

    D J R R S 19 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

      D Offline
      D Offline
      David ONeil
      wrote on last edited by
      #2

      How the hell would someone know that "[0-9]{1,3}" is enough to find sequential numbers in Microsoft Word? How the hell did I find that magic? Every regular expression seems to require a convoluted google search. Crazy world...

      Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

      T J 2 Replies Last reply
      0
      • D David ONeil

        How the hell would someone know that "[0-9]{1,3}" is enough to find sequential numbers in Microsoft Word? How the hell did I find that magic? Every regular expression seems to require a convoluted google search. Crazy world...

        Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

        T Offline
        T Offline
        trønderen
        wrote on last edited by
        #3

        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 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

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

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

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

          M G H 4 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

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

            They should be called irregular expressions. :-D

            M G 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

              R Offline
              R Offline
              raddevus
              wrote on last edited by
              #6

              The following quote is the only good thing I've found in relation to RegEx...

              Anonymous Dev said:

              Some people, when confronted with a problem, think "I know, I'll use a RegEx." Now they have two problems.

              :rolleyes:

              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

                M Offline
                M Offline
                Mike Hankey
                wrote on last edited by
                #7

                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 2 Replies Last reply
                0
                • R Ron Anders

                  They should be called irregular expressions. :-D

                  M Offline
                  M Offline
                  Mike Hankey
                  wrote on last edited by
                  #8

                  Ron Anders wrote:

                  They should be called irregular expressions.

                  Or ChineseExpressions, because I'll become more proficient in Chinese before RegEx!

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

                  1 Reply Last reply
                  0
                  • 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
                                          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