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. Other Discussions
  3. The Insider News
  4. Arithmetic with Regexps

Arithmetic with Regexps

Scheduled Pinned Locked Moved The Insider News
perlhtmlcomregexhelp
3 Posts 3 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 Offline
    T Offline
    Terrence Dorsey
    wrote on last edited by
    #1

    Brain Dump[^]:

    There's a secret for Perl being so good at code golf, and this secret is clever use of regexp. The regexps from Posix are just finite automata, but the Perl engine is much more powerful than that. Naturally, I became tempted to check what are the computational limits of Perl's regexp. For example, can we do arithmetic with regexps? After thinking I while, I concluded that yes, we can do arithmetic with regexps!

    When a problem arises, some think "I know, I'll use regex." Now you have a quadratic equation.

    M 1 Reply Last reply
    0
    • T Terrence Dorsey

      Brain Dump[^]:

      There's a secret for Perl being so good at code golf, and this secret is clever use of regexp. The regexps from Posix are just finite automata, but the Perl engine is much more powerful than that. Naturally, I became tempted to check what are the computational limits of Perl's regexp. For example, can we do arithmetic with regexps? After thinking I while, I concluded that yes, we can do arithmetic with regexps!

      When a problem arises, some think "I know, I'll use regex." Now you have a quadratic equation.

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      Terrence Dorsey wrote:

      When a problem arises, some think "I know, I'll use regex."

      Now you have 2 problems the one you started with and regex.

      "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

      D 1 Reply Last reply
      0
      • M Matthew Faithfull

        Terrence Dorsey wrote:

        When a problem arises, some think "I know, I'll use regex."

        Now you have 2 problems the one you started with and regex.

        "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

        D Offline
        D Offline
        dusty_dex
        wrote on last edited by
        #3

        You would probably have 3 problems. The third problem would be maintaining the will to live.

        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