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 2 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.
  • 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
                        • P Paul Sanders the other one

                          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 Offline
                          T Offline
                          thewazz
                          wrote on last edited by
                          #29

                          Except there's a spelling mistake.

                          P 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

                            M Offline
                            M Offline
                            Mark Starr
                            wrote on last edited by
                            #30

                            Love how you post an opinion - always a valid one - and then (I assume) watch the conversation roll through. Bet you’re a gem at parties. I learned the basics of regular expressions many years ago when learning Perl. While I still use it on occasion for simple searches involving a specific character sequence, I don’t use it regularly (pun acknowledged) - aside from a few functions like email-check etc.

                            Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

                            H 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

                              M Offline
                              M Offline
                              Matt Bond
                              wrote on last edited by
                              #31

                              Memories? I still use it.

                              Bond Keep all things as simple as possible, but no simpler. -said someone, somewhere

                              M 1 Reply Last reply
                              0
                              • M Mark Starr

                                Love how you post an opinion - always a valid one - and then (I assume) watch the conversation roll through. Bet you’re a gem at parties. I learned the basics of regular expressions many years ago when learning Perl. While I still use it on occasion for simple searches involving a specific character sequence, I don’t use it regularly (pun acknowledged) - aside from a few functions like email-check etc.

                                Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

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

                                It's because I slept. :) But yeah, I get bit overwhelmed when I get a lot of responses, so I kind of respond as I'm able.

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

                                M 1 Reply Last reply
                                0
                                • T thewazz

                                  Except there's a spelling mistake.

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

                                  Oh yes! Two, if you're a Yank :)

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

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

                                    It seems like it would be difficult to describe a non-trivial match in human language. Though you might be able to feed a regex expression to ChatGPT and ask it what it matches - sort of the reverse of what you suggested.

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

                                    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

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

                                      A long time ago I wrote a tool. The tool allowed you to multiply select portions of text and it would attempt to generate regexs that would only match the selected text It didn't work very well, at least my implementation but I think the idea has merit.

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

                                      K 1 Reply Last reply
                                      0
                                      • S seismofish

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

                                        seismofish wrote:

                                        I know of no tool with anywhere near the power for parsing text.

                                        Well, tokenizing text at least. :) I've written plenty of parsers, everything from LL(1) to GLR. GLR is the most powerful parsing algorithm I know of, allowing you to parse ambiguous grammars and return one tree for each possible interpretation. My parsers almost always use regex to tokenize, but they don't use it to parse. Instead, I take those tokens, and a Push Down Automaton and use that to generate trees. Sorry, not trying to be pedantic so much as continue to convo.

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

                                        1 Reply Last reply
                                        0
                                        • M Maximilien

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

                                          A modest proposal: Learn the DFA subset. Commit it to memory, and forget the rest. DFA is the non-backtracking subset of regular expressions () - capture and group [] - match char ranges * - match zero or more + - match one or more ? - match zero or one . - match any single character | - match a or b (a|b)

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

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