RegEx compilation thread

    Joined
    Jan 11, 2017
    Messages
    168
    Reaction score
    83
    your post is gonna look silly when I ret-con the heck out of that post XD I had to copy some text over from another comp, didnt want to leave it because I havent actually finished building the regex to go along with the text...
    Oh? Find some fun new things to play with?
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    yup! I've built a bit of a pointer system, I still need to set up the logic that makes the pointers point to everything, but I've made the system that reads from the ram display. I've updated the regex compilation board with the design, for people interested.
    the new logic contains: a pointer to value, a variable to pointer, and a variable to value module.
    Jaaskinal:
    One thing I haven't been able to figure out is the way that you had a string of hex instead of some other easier to read system. How can you tell the different transactions apart? Does the hex show how many of what category you take?
     
    Joined
    Jul 30, 2013
    Messages
    398
    Reaction score
    282
    • Wired for Logic Gold
    • Legacy Citizen 8
    • Purchased!
    The system I am using is this:

    - Name of the variable.
    - Variable identifier.
    - Value / data that the identified variable must have.

    By this I mean for example:

    PlayerPoints1[200]PlayerPoints2[300]PlayerPoints3[400]PlayerPoints4[500]

    - PlayerPoints: Is the name of the variable
    - 1,2,3,4... : Is the identifier of the variable.
    - [200]: Is the value / data that the identified variable contains.

    This gives me the versatility of not having to use ";" or "spaces" to separate the different variables, with this I can more efficiently "condense / use" the space of the display blocks.

    The process of "recording data" only need to specify the name of the variable, give it an identifier, and set the data it contains ( Same process to read the data or modify it ).

    This also gives me the versatility, that if I have to access the data of many variables with the same name, I just have to change the identifier, which translates to speed and fewer processes.

    I hope, to have been totally clear, that for me, this is the best option to save information, instead of converting the data to HEX, BINARY or any other format. If I want to save the text "Roses are red", why should I convert that string?
    [Roses are red]
    HEX (52 6f 73 65 73 20 61 72 65 20 72 65 64)
    BINARY (01010010 01101111 01110011 01100101 01110011 00100000 01100001 01110010 01100101 00100000 01110010 01100101 01100100)

    You can see the difference?
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    You should look at my breadboard, the way I'm storing the values doesn't use any spacers, only the user friendly reference table does :P
    The point of my system is to make a more dynamic type of memory, one that is compatible with any other logic circuits. I had intended to encode the data as hex, but I don't understand how to do that yet, or if it would even be more efficient block wise.

    And strings are always going to be large, the big bonus that this type of data storage has it that it can change a large decimal number into a compact one. I'm thinking it would be very effective for things like game save states or just complex data storage in general.
     

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    One thing I haven't been able to figure out is the way that you had a string of hex instead of some other easier to read system. How can you tell the different transactions apart? Does the hex show how many of what category you take?
    I was just using it to store the transactions, having it be easy to read was not entirely the intention.

    There's two lines of displays, each stores different information. The bottom stores Hex, and it's only collecting information about which accounts are using the Nasometer, and in what order. The top line stores in base-8+1, and it only stores what material was accessed. The system to figure out how much was taken out is sorta a pain in the neck, and a fair bit larger, but if I figure out how to make it smaller, I might incorporate it into the next version. Generally though, if you wanted to get the actual of every transaction out of the machine, you'd want to copy and paste all of the displays from right to left into a text editor with a monospace font option, with the top data on top, and the bottom data on bottom. Every vertical column is a singular transaction, and the transaction would go (from left to right) oldest to newest.

    In terms of the metadata I get out of it right now, that is exclusively counting the number of occurrences of each account and material type.
     

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    I think you already had this on your breadboard Fellow Starmadian , but I didn't really understand it that well, so I re-made it simpler.

    For this function, I'm using two display modules, one stores data, and one needs to be modified to extract that data. The purpose of this function is to access coordinates which have been saved with a variable name.

    Regex101 - online regex editor and debugger

    If you replace the first 2 with either of the other two variable names, it'll just come up with their coordinates instead. You can also add coordinates, as long as you follow the general format, and have it still output the information you request.
    so many parenthesis

    I decided to make a better version for myself.


    Regex101 - online regex editor and debugger
     
    Last edited:
    • Like
    Reactions: Gasboy

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    Actually that's what I added in the current compilation breadboard update, but with a bunch less parentheses XD You should notice several similarities in what the regex selects. Here's the regex that is similar to yours: Regex101 - online regex editor and debugger
    just replace the hex code for variables and bam! Same as yours.

    Here's some very similar code that seperates the flag from the data inside the brackets: Regex101 - online regex editor and debugger
    It should be fairly easy to modify this code, all three of the regex statements in the pointer groundwork circuit are basically the same, they just return a different group.

    I'll be working on two things today: The module controller and the dynamic data allocator for the (Ram?) pointer groundwork circuit. Should just be one of the regex counters combined with a bit of simple <[add]> and <[replacefirst]()[with]> regex

    Jaaskinal, I feel perplexed by your use of boolean OR to match different end marks? you can just use ' .* ' to match any character an unlimited amount of times, except white space. And if you wanted to add a way to specify what type of data is stored in that variable, I added the groundwork for that already myself. Currently, there is an "invisible" character space at the beginning, preceded by a \ followed by a letter. That letter can be used to specify what type of variable is stored.
     
    • Like
    Reactions: Jaaskinal

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    I forgot to explain how my regex works I think, and even though you didn't specifically ask I'm gonna explain anyway :P
    I use three stages to return a value when entering a variable name, simply because it was the easiest thing to do at the time. To explain the modules, Ill use the term Module 1, 2, and 3, going from left to right. Module 1 just enters the variable name into module 2. Module 2 sends the pointer value to module 3, which returns the value stored in that memory location. Module 3 just sends it's output back to the first module, for simplicity.

    I could cut it down to two tables, one with the variable name and value, and one with a hex variable name and a value, but that would mean that one or the other was unnecessary. It would also reduce the storage density, which is obv. sub par. Another reason for leaving the data tables the way they are, is because it allows me to do one of two things: either use the user friendly variable, or a more compact and easier to use hex value, similar to how you would be able to use it in a language like C++. You can show & modify the correlations between the value, the variable, and the pointer value.

    p.s. I need to remember to use tahoma font, I'm sure my inconsistency is annoying :/

    edit: If you're confused as to why I use a copied data table and reference table, it's just so I can freely trim the non-matching variables without hurting the main table. It's fairly easy to re-inject values back into the memory, as a matter of fact I've already done so on teh breadboard. This is going to be a very long project, but when complete I hope to have a starmade equivalent of a electronic technicians box of ICs, just pop one onto a breadboard and connect the pins as required.
     
    • Like
    Reactions: Jaaskinal

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    Update but it's 4:15 AM: I added the rest of the new value adding system, except for the add blocks that add them back to the main data display. Now to fix the variable extractor / inkjetter to work with my system. After that it's just the IC control and data flow module and BAM, I think the framework for this system will be complete. Then I'll make a tutorial breadboard for people that want to convert their regex circuits to match my system. As long as you have input / output, you should just have to plop a controller module onto the different ins + outs and it should all work perfectly. It'll also be possible to cut down on most people's circuits by replacing the boolean logic with regex parses.

    -a very tired starmadian signing off

    edit: tahoma
    edit: so tired i typed the wrong hour.
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    important question: Should I store the data type flag in the variable > pointer table, or the pointer > value table? Pic for reference:

    The /<letter> is the data type flag. I think I might want to put it in the bottom display, but that would decrease the data density. It would also simplify the data transfer process between modules though... Any suggestions? I'll answer any questions you guys have, I need some feed back on my design.
     

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    important question: Should I store the data type flag in the variable > pointer table, or the pointer > value table? Pic for reference:

    The /<letter> is the data type flag. I think I might want to put it in the bottom display, but that would decrease the data density. It would also simplify the data transfer process between modules though... Any suggestions? I'll answer any questions you guys have, I need some feed back on my design.
    Everything is always going to be a compromise between readability and density. In terms of what I'm doing, I doubt I'm ever going to use that sort of flag, because I already know what type of variable I'm looking for when I search for it. If you're using an application that needs it, then of course it's necessary, unless you can create regex, or a simple couple of displays, that can sort out the data flags and add them in on the fly, I'd say just use them all the time.
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    So I guess I'll put them in with the pointer > variable table, it's actually really easy to remove / add the data type flag. Im using a flag not for my purposes, but for unforeseen future purposes, just in case I guess. Thanks :)
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    Wow, time sure flies right? I don't want this thread to go the way of my previous logic threads and just die out, so I'll post a quick little update. I have the whole regex system for input and output from logic circuits all mapped out, but I haven't put the work into actually building any of it. For you see, I'm a lazy Y-hole. (kek starmade reference)

    Any who, on to a quick description of the system: Using some regex templates, any circuit can be retrofitted to use this system. I plan to make response times between different circuits less than one logic cycle, because other than that it would just be quicker to build everything together in the first place. The system should be able to pick out any number of arguments from a string that is handed it, and properly feed signals to the logic circuit given those inputs.

    For an example:
    A logic circuit needs to have a number added to another number. Using the regex output template, it sends a string to the controller module, including it's own name in the string.
    [ ;main;calc;+;2;2;4; ]
    The controller module then uses it's database of connected modules to feed the string, minus the module names, to the correct logic circuit.
    [ ;+;2;2;4; ]
    The logic circuit receives that string, and using its built in parser from the regex input template, decodes the signal and sends the proper logic signals to the circuit. After doing its calculations, it then sends a return signal similar to this:
    [ ;calc;main;8; ]
    The process is then repeated so the string is sent to the proper module.

    The issue I see with this is that it would be difficult to decide what to do with this data, as each regex input would have to have dedicated logic for each of the modules that it can receive data from. I quickly thought of a method to solve this, using the helpful regex counters that several posters have shown me. Inside the module controller would have to be a simple counter, that gives a ticket number to each process being performed by the different circuits. It might be possible, using this method, to make a pseudo multi-threaded CPU, though I'm not sure how efficient it would be. There would have to be data buffers on the input and output of the module controller, or I guess in this case it would be called the CPU?

    This post is a bit longer than I anticipated, but it helps to substantiate my ideas, it helps me to think when I write everything down. When I'm done being a Y-hole in regards to my dedication to a project, this will be what will take up all of my work time.
     
    Joined
    Jul 30, 2013
    Messages
    398
    Reaction score
    282
    • Wired for Logic Gold
    • Legacy Citizen 8
    • Purchased!
    Thanks to the regex commands, we have more or less efficient ways of storing / read / edit "data", now it is necessary to construct the "peripherals" to enter / use that data, like keyboards, screens and others ... i still waiting "green" force fields for make my own RGB screen -__- ... please schema make it real
     
    Joined
    Jul 30, 2013
    Messages
    398
    Reaction score
    282
    • Wired for Logic Gold
    • Legacy Citizen 8
    • Purchased!
    A new contribution from my hand, if you have asked how to "detect" if a display block can no longer contain "more lines of text", or can no longer contain "more characters" X , I have found these solutions:
    Code:
    This detect the number of characteres in a line (current limit 240)
    [REPLACEALL]^.{240,}$()[WITH]$1
    Regex101 - online regex editor and debugger
    Code:
    This detect the number of lines (current limit 10)
    [REPLACEALL]^(?>\V*\n\w){10,}\V*$()[WITH]$1
    Regex101 - online regex editor and debugger

    * I have used a special syntax " ?> "of the regex commands called "atomic groups". See this link for more information.

    When we use this syntax {... , ...} is when we want to DEFINE the limits of the comparison that precedes it, so if we want to count / compare a certain number of "characters" we will use "." (The point is used To detect any character other than a line break)

    We use ^ ... $ to define the START and END of the string, so that the regex command takes into consideration the entire line.

    I think these commands will be a great help
    Hi, i must add this other regex command constructed intentionally to detect the maximum characteres of a display block (multiline characters count too):
    Code:
    This detect the number of total characters in a display block(current limit 240)
    [REPLACEALL]^(.|\n){240,}$()[WITH]$2
    Regex101 - online regex editor and debugger

    $2 Replaces all text present within the display block with an "empty" string (this erases all text), so adding any text after $2, will be replace the text present in the display block with the desired text :)
     
    Last edited:

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    I'm confused why you needed to count the individual characters, since this code does the same thing:
    Code:
    [replacefirst].*()[with]$1
    or
    [replaceall].*()[with]$1
    (since there is only two matches no matter what.)
    Regex101 - online regex editor and debugger
    Also I realize I've been neglecting to update this thread, I really don't have any excuses. I have made some progress on my modular regex system, but it's nothing to write home about yet. I've been doing logic "odd jobs" for practice, since I am currently stuck on an issue with my modular regex system. Most recently I've made a sensor to detect changes in a ship's velocity.

    But back to my big project. I'm currently stuck on the finer points of how each module communicates with another. I do have a pseudo breadboard on paper that looks promising, and while I don't know the terminology hopefully I can get my ideas across. My current design uses a central controller module that uses a type of ticket system to give an ID to any traffic traveling through it. This SHOULD allow modules to receive, process, and send information in their own time. The system I have planned is semi-analogous to TCP, or Transmission Control Protocol.
     
    Joined
    Jul 30, 2013
    Messages
    398
    Reaction score
    282
    • Wired for Logic Gold
    • Legacy Citizen 8
    • Purchased!
    I'm glad that you update your post again, it's something that all players can use in the future.

    I have seen the need to "know" how many characters are present in a display block, and if they exceed a certain amount, do one thing or another (in this case, go to the next display block, to do the scrolling effect).

    Answering your question of why I need to use this complicated regex command, instead of a simpler one as you propose is, I want to "detect" the present amount of characters inside the display, instead of "selecting" all the Text and delete it.

    For now, I have finished the part of the "screen" and the method used to create the "commands".

    Multiline display with scroll function in only 5x5x6, all the small modules behind, are the commands i make for test the screen.
     
    Joined
    Mar 9, 2015
    Messages
    3
    Reaction score
    2
    Lightweight counter ( [0-9] > \d) :
    Code:
    [REPLACEALL](\d+)[WITH]0$1~01234567890
    [REPLACEALL]\b0(?!9*~)|(\d)(?=9*~\d*?\1(\d))|~\d*[WITH]$2
    Countdown :
    Code:
    [REPLACEALL](\d+)[WITH]$1~09876543210
    [REPLACEALL](\d)(?=0*~\d*?\1(\d))|~\d*[WITH]$2
    [REPLACEALL]0*(\d*)[WITH]$1
     
    Last edited: