[{"data":1,"prerenderedAt":547},["ShallowReactive",2],{"project-42974378":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":45,"post_text":48,"what":49,"said":85,"maker_in_thread":251,"shape":264,"grid":268,"attempts":510,"same_week":511,"maker_shows":43,"maker_hidden":539,"reader_version":540,"card":541},"42974378","trre","Transductive regular expressions for text editing","title","Show HN: Transductive regular expressions for text editing","https:\u002F\u002Fgithub.com\u002Fc0stya\u002Ftrre","github.com","c0nstantine",1738945094,2025,263,102,215,3837,6,"legend","dev_tools","text editing regex tool","cli",[24,25,26,27],"regular expressions","finite state transducer","text transformation","search and replace","mixed",-0.169,{"positive":31,"neutral":32,"mixed":33,"critical":34},10,20,1,19,50,{"design":37,"idea":40,"execution":42,"docs":44},{"positive":38,"critical":39},0,4,{"positive":41,"critical":41},9,{"positive":33,"critical":43},2,{"positive":38,"critical":39},[33,46,38,33,33,38,38,33,47,46,46,46,33,46,46,47,33,47,47,33,46,33,33,46,46,47,38,47,47,38,38,38,33,33,46,33,46,46,46,33],3,5,"An extension of regular expressions for text editing, with a grep-like command-line tool. If you, like me, struggle with group logic in regular expressions, you might find it useful.\n\nI wanted to do this for a very long time. It is more of a sketch or prototype. I'd really appreciate your feedback!",{"problem":50,"audience":56,"pricing":56,"motivation":57,"time_to_build":64,"stack":70,"openness":82,"stage":83,"team_size":84},{"value":51,"source":52,"evidence":53},"Regex is awkward for text editing and group logic","maker",[54],{"id":55},"post",null,{"value":58,"source":52,"evidence":59},"Maker struggles with group logic in regex and wanted to explore finite transducers for text transformation",[60,61],{"id":55},{"id":62,"by":11,"text":63},"42985442","Thank you for the detailed comment. So Unicode is something on a top of my TODO list. Boundaries is a very interesting topic. Maybe I'll extend the doc to include the details. >…",{"value":65,"source":52,"evidence":66},"A few months",[67],{"id":68,"by":11,"text":69},"42983192","Oh, I've learnt a lot. Initially wanted to complete the whole project in two weeks and it took a few months. The hardest part was the DFT determinization algorithm design. Thanks…",[71],{"value":72,"source":73,"evidence":74},"C","inferred",[75,79],{"id":76,"by":77,"text":78},"42975423","wfn","What a pleasure your C code is :) very nice (currently reading it) My only quick comment is - the link to `theory.pdf` in README is broken (your pdf is in docs\u002F dir, so just need…",{"id":80,"by":11,"text":81},"42975658","Thank you! For the feedback and pointing to the typo. Fixed. Actually my C is very rusty and I am bit uncomfortable about this.","open_source","prototype","unknown",{"praise":86,"objections":111,"requests":172,"questions":196,"alternatives":209},[87,100],{"value":88,"source":89,"evidence":90},"Interesting idea and clean small C code","commenter",[91,92,96],{"id":76,"by":77,"text":78},{"id":93,"by":94,"text":95},"42975382","sabellito","I love the idea, wanna se where it goes. Gives me the same vibe as when jq came out all those years ago.",{"id":97,"by":98,"text":99},"42977603","agumonkey","very inspiring idea, makes me wanna start projects I had in mind related to that. thanks and good luck",{"value":101,"source":89,"evidence":102},"Transducers are a powerful approach for in-place text transformation",[103,107],{"id":104,"by":105,"text":106},"42976145","larodi","In place replacing the text while parsing is very powerful approach. Fingers crosses this flies. This, combined with probabilistic approach can be even more interesting.…",{"id":108,"by":109,"text":110},"42978487","synthc","Interesting! I did an internship where I tried to use transducers for fast information extraction. In theory, you can use FST's for fast approximate parsing. I didn't really work…",[112,127,146,165],{"value":113,"source":89,"evidence":114},"Operator precedence for colon is unnatural",[115,119,123],{"id":116,"by":117,"text":118},"42975185","danielparks","Cool, I’m interested to see where you go with this. I found the operator precedence unnatural, and it looks like a lot of other folks in this thread did too. I would naturally…",{"id":120,"by":121,"text":122},"42976409","layer8","I would give the colon operator lower precedence than concatenation and repetition.",{"id":124,"by":125,"text":126},"42975299","froh","sweet, I did my \"Diplom\" CS thesis around 1997 on finite state transducers. was mich less trivial than I'd thought. the ask was to implement composition and DFAs where possible.…",{"value":128,"source":89,"evidence":129},"Docs and examples are wrong or underspecified",[130,134,138,142],{"id":131,"by":132,"text":133},"42974931","andrewla","I feel like this is very underspecified, The very first example: ``` $ echo 'cat' | trre 'c:da:ot:g' dog ``` Feels strange. What is happening here; the grammar says ``` TRRE \u003C-…",{"id":135,"by":136,"text":137},"42974542","i3oi3","Are the examples all actual outputs of the program? It's entirely possible that my understanding of the grammar is off, but it looks like these examples are wrong: $ echo 'cat…",{"id":139,"by":140,"text":141},"42977762","MathMonkeyMan","From the readme: ``` $ echo 'cat' | trre 'c:da:ot:g' dog ``` Why? Elsewhere, the readme says that \":\" is \"non-associative\", and I had a look at the language grammar but haven't…",{"id":143,"by":144,"text":145},"42974512","the_arun","> $ echo 'xor' | '(x:)or' 'xor' > cat I got lost here.",{"value":147,"source":89,"evidence":148},"No convincing examples of advantage over regex or sed",[149,153,157,161],{"id":150,"by":151,"text":152},"42974829","crazygringo","> Regular expressions is a great tool for searching patterns in text. But I always found it unnatural for text editing. The entire purpose of this project seems to hinge on this…",{"id":154,"by":155,"text":156},"42977459","groby_b","It's a cool exploration, but I'm missing examples of why it's actually better. (Which, TBF, might just be an indicator I spent too much time with regexps :) I.e - why is trre…",{"id":158,"by":159,"text":160},"42975651","metadat","When I saw this headline, I got excited about the prospect of a new innovation in the application of Regular Expressions. After reading, I was scratching my head because trre…",{"id":162,"by":163,"text":164},"42976596","pmarreck","so basically just `sed -e`?",{"value":166,"source":89,"evidence":167},"Build and -g flag errors in installation",[168],{"id":169,"by":170,"text":171},"42976094","simlevesque","I ran the installation lines and got this error: ``` make && sh test.sh cc -std=c99 -Wall -Wextra -Wpedantic -o2 trre_nft.c -o trre cc -std=c99 -Wall -Wextra -Wpedantic -o2…",[173,178,184,189],{"value":174,"source":89,"evidence":175},"Clearer examples showing advantage over regex",[176,177],{"id":150,"by":151,"text":152},{"id":154,"by":155,"text":156},{"value":179,"source":89,"evidence":180},"Support for structural or tree-based substitution",[181],{"id":182,"by":121,"text":183},"42976638","This doesn’t seem sufficient as soon as you want to perform some kind of structural substitution, for example doing the equivalent of s\u002F\"([^\"]*)\"\u002F'$1'\u002F. If it could do that and…",{"value":185,"source":89,"evidence":186},"Change colon precedence to lower than concatenation",[187,188],{"id":120,"by":121,"text":122},{"id":124,"by":125,"text":126},{"value":190,"source":89,"evidence":191},"Disallow * and + on right side",[192],{"id":193,"by":194,"text":195},"42975400","zoogeny","> Avoid using * or + in the right part, as it can cause infinite loops Why not just disallow this? I understand it would make the grammar more difficult to specify - but I don't…",[197,202],{"value":198,"source":89,"evidence":199},"Why does 'c:da:ot:g' produce dog",[200,201],{"id":131,"by":132,"text":133},{"id":139,"by":140,"text":141},{"value":203,"source":89,"evidence":204},"How the range operator behaves with [a:A-z:x]",[205],{"id":206,"by":207,"text":208},"42978875","skykooler","Not sure the range operator is fully specified, this works and seems like it shouldn't: ``` echo \"regular expressions\" | .\u002Ftrre \"[a:A-z:a]\" REGULAR EXPRESSIONS ``` In fact,…",[210,219,230,237,244],{"value":211,"source":89,"evidence":212},"sed",[213,214,215],{"id":158,"by":159,"text":160},{"id":162,"by":163,"text":164},{"id":216,"by":217,"text":218},"42976384","kazinator","This is nifty --- and small. You could port this to like V7 Unix from 1979 or earlier; why didn't they get this idea? :) Tools like sed build a transducer around the whole…",{"value":220,"source":89,"evidence":221},"Xerox XFST and FOMA",[222,226],{"id":223,"by":224,"text":225},"42977711","languagehacker","For folks interested in finite-state transducers and other kinds of tooling available, check out XFST (Xerox Finite-State Transducer), which has been used in computational…",{"id":227,"by":228,"text":229},"42977712","jll29","Check out Xerox XFST and its open source clone FOMA for finite state transducers as described by extended regular expresssions, both of which describe the language of regular…",{"value":231,"source":89,"evidence":232},"Rosie Pattern Language",[233],{"id":234,"by":235,"text":236},"42977375","Lanzaa","If you are looking for an alternative to standard regex, especially if you have trouble with group logic and are looking for something maintainable, you might like the Rosie…",{"value":238,"source":89,"evidence":239},"Carmel",[240],{"id":241,"by":242,"text":243},"42975621","BFPQVZ","Another alternative that is similar would be Carmel (https:\u002F\u002Fgithub.com\u002Fisi-nlp\u002FCarmel-Repository)",{"value":245,"source":89,"evidence":246},"VS Code regex replace",[247],{"id":248,"by":249,"text":250},"42981884","aqueueaqueue","Another alternative is regex and use replace all. Then you cam replace the regex cat with dog (or use a group for wrapping with space) This is a common modus operandi for me in…",{"comments":252,"answered":253,"key":254},29,12,[255,258,261],{"id":256,"text":257},"42981181","[a-z] is equivalent to 'a|b|...|z' in the normal regex language. So if we do [a-z]:[A-Z] it should be expanded to: (a|b|...|z):(A|B|...|Z) which is pretty legal in trre but has…",{"id":259,"text":260},"42982090","The right side is a normal regex language syntactically. Semantically it is a generator instead of a parser (consumer). But I got your point. Maybe there could be some ways to do…",{"id":262,"text":263},"42976368","Thank you for the feedback. Yes, the precedence is a question for me. Maybe I will change this. If I shift it behind concatenation there could be another problem. E.g. with…",{"commenters":265,"max_depth":266,"maker_replies":252,"first_comment_mins":31,"lifespan_hours":267},54,7,178,[269,271,275,277,279,282,283,285,286,289,291,293,297,301,303,305,308,311,314,317,318,320,323,325,327,329,332,334,335,338,341,344,346,348,349,353,355,357,359,362,364,368,370,373,375,376,378,380,383,386,388,390,393,395,397,399,401,402,404,407,409,412,415,416,419,423,425,427,430,432,435,437,439,443,446,448,451,454,456,458,460,462,464,465,467,469,471,474,477,479,481,484,486,488,493,495,497,499,501,503,505,508],[116,38,33,270,117,38],"project\u002Fcritical\u002Fdesign",[272,38,46,273,274,38],"42976249","project\u002Fneutral\u002Fdesign","twiss",[276,38,46,273,217,38],"42976404",[256,38,38,278,11,33],"maker\u002Fneutral\u002Fdesign",[280,38,38,281,217,38],"42981272","commenter\u002Fneutral\u002Fdesign",[259,38,38,278,11,33],[284,38,38,281,217,38],"42985189",[262,38,38,273,11,33],[287,38,33,270,288,38],"42978512","kccqzy",[290,38,38,273,11,33],"42990025",[292,38,46,273,288,38],"42996959",[294,38,33,295,296,38],"42980187","project\u002Fcritical\u002Fidea","bane",[298,38,38,299,300,38],"42982667","commenter\u002Fneutral\u002Fidea","Timwi",[302,38,38,273,11,33],"42985326",[223,33,38,304,224,38],"other\u002Fneutral\u002Fnone",[306,33,38,304,307,38],"42977883","kreyenborgi",[309,33,38,304,310,38],"42978542","woodson",[312,33,38,304,313,38],"42977968","ChuckMcM",[315,33,38,304,316,38],"42980355","mcyc",[234,43,33,295,235,38],[124,46,47,319,125,38],"maker\u002Fpositive\u002Fidea",[321,46,38,304,322,38],"42975540","Etheryte",[324,46,38,273,11,33],"42975606",[326,46,46,273,125,38],"42976275",[62,46,38,328,11,33],"project\u002Fneutral\u002Fidea",[330,46,38,304,331,38],"42976035","username223",[333,46,38,304,310,38],"42987309",[182,39,46,328,121,38],[336,39,46,273,337,38],"42977874","johnnymellor",[339,39,38,340,121,38],"42979262","commenter\u002Fneutral\u002Fnone",[342,39,33,270,343,38],"42982490","tomashubelbauer",[345,39,38,340,11,33],"42983330",[347,39,38,273,11,33],"42983325",[150,47,33,295,151,38],[350,47,47,351,352,38],"42975278","project\u002Fpositive\u002Fidea","everdimension",[354,47,38,328,11,33],"42975468",[356,47,46,328,151,38],"42975617",[358,47,38,328,11,33],"42975972",[360,47,46,328,361,38],"42975934","rendaw",[363,47,47,351,322,38],"42975514",[365,47,46,366,367,38],"42977012","project\u002Fmixed\u002Fidea","psychoslave",[68,47,38,369,11,33],"maker\u002Fneutral\u002Fnone",[371,47,33,295,372,38],"42976656","zokier",[76,18,47,374,77,38],"maker\u002Fpositive\u002Fexecution",[80,18,38,369,11,33],[193,266,46,377,194,38],"project\u002Fneutral\u002Fexecution",[379,266,38,377,11,33],"42975543",[381,266,47,351,382,38],"42975671","shawnz",[384,266,38,385,11,33],"42981833","project\u002Fneutral\u002Fdocs",[154,387,33,295,155,38],8,[131,41,33,389,132,38],"project\u002Fcritical\u002Fdocs",[391,41,46,385,392,38],"42975103","Imustaskforhelp",[394,41,46,273,117,38],"42975235",[396,41,38,273,11,33],"42981202",[398,41,33,389,288,38],"42975807",[400,41,38,385,11,33],"42981866",[135,31,33,389,136,38],[403,31,38,385,11,33],"42974625",[405,31,46,385,406,38],"42975079","meonkeys",[408,31,38,385,11,33],"42975997",[410,31,38,340,411,38],"42981578","robertlutece",[206,413,33,414,207,38],11,"project\u002Fcritical\u002Fexecution",[104,253,47,351,105,38],[417,253,38,418,11,33],"43017036","maker\u002Fneutral\u002Fidea",[420,421,47,351,422,38],"42979182",13,"kemiller",[424,421,38,369,11,33],"43002116",[426,421,38,340,422,38],"43016623",[108,428,38,429,109,38],14,"other\u002Fneutral\u002Fidea",[93,431,47,351,94,38],15,[433,431,38,434,11,33],"42981873","maker\u002Fpositive\u002Fnone",[227,436,46,328,228,38],16,[139,438,46,385,140,38],17,[440,441,47,351,442,38],"42974750",18,"mordechai9000",[444,441,38,340,445,38],"42975866","rjh29",[447,441,38,369,11,33],"43003701",[449,34,38,304,450,38],"42979487","YeGoblynQueenne",[452,34,38,340,453,38],"42983695","CyberDildonics",[455,34,38,340,450,38],"43005253",[457,34,38,340,453,38],"43005639",[459,34,38,340,450,38],"43035150",[461,34,38,340,453,38],"43049603",[463,34,38,340,450,38],"43055088",[216,32,33,295,217,38],[466,32,38,369,11,33],"42981009",[248,468,33,295,249,38],21,[143,470,33,389,144,38],22,[472,470,38,473,11,33],"42974552","maker\u002Fneutral\u002Fdocs",[475,470,46,385,476,38],"42974621","trashburger",[120,478,46,273,121,38],23,[169,480,33,414,170,38],24,[482,480,38,483,11,33],"42976501","maker\u002Fneutral\u002Fexecution",[485,480,46,369,170,38],"42984781",[487,480,38,483,11,33],"42997642",[489,490,46,491,492,38],"42979277",25,"project\u002Fneutral\u002Fnone","ngruhn",[97,494,47,351,98,38],26,[158,496,33,295,159,38],27,[498,496,38,418,11,33],"42976603",[500,496,46,369,159,38],"42977018",[241,502,46,328,242,38],28,[504,502,38,418,11,33],"42981023",[506,252,33,270,507,38],"42975626","teknopaul",[162,509,33,295,163,38],30,[],[512,516,521,525,530,534],{"id":513,"name":514,"points":515,"category":20},"43000303","pdfsyntax",451,{"id":517,"name":518,"points":519,"category":520},"42975803","theretowhere",321,"consumer_social",{"id":522,"name":523,"points":524,"category":20},"42965198","sqlite-page-explorer",288,{"id":526,"name":527,"points":528,"category":529},"43027335","Game Bub",274,"hardware",{"id":531,"name":532,"points":533,"category":20},"42984420","FlashSpace",255,{"id":535,"name":536,"points":537,"category":538},"42977388","ExpenseOwl",227,"productivity",false,"v2",{"id":542,"name":5,"line":6,"ai":539,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":543,"top":18,"kw":544,"maker":11,"domain":10,"tier":19,"attempts":38,"strip":545,"url":9,"mix":546,"praise":88,"objection":113,"sub":21},42974378,-0.17,[24,25,26,27],"1301100153331335155131133505500011313331",[31,32,33,34],1793991112548]