Re:Regex2fat: Turn your favorite regex into FAT32
by Rokid on Wednesday April 15, 2020 @02:29PM
(#22881240)
What is this? I'm so curious but nothing of this rings a bell with me. I mean I know what a regular expression is, and I've formatted several USBs to FAT32, but DFAs and everything in between have me Googling like crazy, still in the dark though.
[ Parent
| on HN ]
Re:Regex2fat: Turn your favorite regex into FAT32
by nicholaides on Wednesday April 15, 2020 @02:59PM
(#22881633)
It converts your regexp into a virtual filesystem and then you can test if a string matches the regexp by converting the string into a path and testing if that path is contained in the filesystem.
Re:Regex2fat: Turn your favorite regex into FAT32
by itronitron on Wednesday April 15, 2020 @05:00PM
(#22883011)
Presumably this is useful if you can place files into (or modify a file at) the location for a particular regexp.
Re:Regex2fat: Turn your favorite regex into FAT32
by duskwuff on Wednesday April 15, 2020 @08:20PM
(#22884760)
I wouldn't necessarily call this useful for anything in particular. It's more of a silly trick to show off than anything. (And a reminder of how regexes work behind the scenes.)
Re:Regex2fat: Turn your favorite regex into FAT32
by Someone on Wednesday April 15, 2020 @05:45PM
(#22883455)
That wouldn’t work. This works by hard linking a lot of directories to each other, so if you were to write a file there, it ends up in multiple locations (possibly all ‘directories’ in the file system)
The file system could work around that by creating new unique directories whenever you write any file to an empty directory, but that would require it to keep the regular expression it represents around, and would fill up the file system quite rapidly.
Re:Regex2fat: Turn your favorite regex into FAT32
by slondr on Wednesday April 15, 2020 @02:35PM
(#22881318)
RegExp and DFAs are the same computation class, so it's useful sometimes to model them as each other.
Re:Regex2fat: Turn your favorite regex into FAT32
by Pmop on Wednesday April 15, 2020 @04:20PM
(#22882558)
No idea why you're being downvoted. Also, classical comp. sci technique of reducing your problem into another that's already been solved (with good enough time/mem bounds).
Re:Regex2fat: Turn your favorite regex into FAT32
by saagarjha on Thursday April 16, 2020 @06:07AM
(#22887813)
It’s frequently useful, as many regex engines construct DFAs under the hood :)
Re:Regex2fat: Turn your favorite regex into FAT32
by burntsushi on Thursday April 16, 2020 @07:59AM
(#22888497)
Not as frequent as you might expect! Most regex engines in common use don't use an automata based implementation, and instead use backtracking. This lets them implement additional non-regular features such as backreferences and recursion.
Even automata based regex engines don't usually build up a full DFA, since the size of the DFA may be exponential in the size of the regex. Instead, an NFA similation might be used, or a hybrid NFA/DFA that builds the DFA during match time, but typically doesn't build out the full DFA.
Re:Regex2fat: Turn your favorite regex into FAT32
by adrianmonk on Wednesday April 15, 2020 @03:27PM
(#22881963)
This was what made it all make sense for me: