Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Were you thinking of something along the lines of Befunge, but for regexen?

Merging a Befunge-like syntax with Perl regex syntax would be amazing. Maybe some interesting alternations such as

to look north and east from the "current" position for a digit.

Using NFA ideas, split the "current" position, and check more than one path. For example, look for palindromes in 1D strings:

m/( # capture whole match (.)? # 0 or 1 middle char ( # capture matched pairs . # 1 char {?\2[<]} # ...left of \2 {?[eq]} # string equal {?\2[>]} # ...right of \2 )* # zero or more times ) # close capture /x;
except that it needs some way to refer to the growing match at each point.

Solving those path problems, like "you can only move to postions which are red on odd moves, and blue or green on even moves", would be easier.

This would need to capture not only the characters matching the regex, but the path as well, since it can no longer be assumed that the chars are in a straight line. Also, can characters already matched be matched again?

This fundamentally depends on what it means to have a multideminsional string. Is a 2D string an array of strings taken in order from $x[0] to $x[$#x]? Is a 3D string an AoA of strings? Or is a 2D string just a normal string with more than one newline? (Then what would a 3D string look like?)

Quantum Mechanics: The dreams stuff is made of

In reply to Re: Multidimensional regular expressions by QM
in thread Multidimensional regular expressions by diotalevi

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (7)
    As of 2021-04-15 12:11 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found