5 ms·
A substitute command is a class of regexes.
by ethanwillis 4y ago
A substitute command is a class of regexes.
- dexterous 4y ago> A substitute command is ~~a class~~ an application of regexes. FTFY (Edit: forgot HN markup doesn't do strikethrough; that's what the ~~'s are for above.)
- svnpenn 4y agoNope. Regular expressions define patterns, which people can then use to extract or transform text.
- ethanwillis 4y agoA substitute command is a TM that generates a class of FSMs. If we want to get into whether or not an FSM with output is a regex, or just the "allowability" of output that's an entirely different discussion. But at it's basis the input is either accepted or not. Which leaves interpretation to the human on what an accept or reject/neither state means.
- svnpenn 4y agoI don't know what the hell you are talking about, but my original post stands. The snippet posted contains a regex pattern, but as a whole its a command, not a regex. Substitution is outside the scope of what RegEx is.
- ethanwillis 4y agoI don't know why you're getting so mad. I stand by my original comment too a substitute command defines a CLASS of regexes. Output of any machine is arbitrary in its interpretation. Step back and think about how any of these machines are implemented physically and how we get "output" or "transforms" or "extracts." That is for any given input the substitute turing machine produces a definitive regex. A subset of regexes (that OP showed) from the total class of regexes that I mentioned in my comment are: /[Aa]re\s[Yy]ou\s\(.*\)?/Indeed, I am sentient./ /[Aa]re\s[Yy]ou\s\(.*\)?/Indeed, I am capable of intelligence./ /[Aa]re\s[Yy]ou\s\(.\*\)?/Indeed, I am going to take over the world./ Not sure why this is so controversial ;)
- svnpenn 4y agoNope. Regex are patterns, that can be compiled in order to extract or replace text. Commands like (s) have been built on top of and using regex. However, you cant just paste some random S command, and say "Hur dur this is regex" , unless you are just trying to look dumb.
- ethanwillis 4y agoI'm sorry, but I don't think you're understanding. Either because you're embarrassed or there's something else going on. Please set aside your ego if that's the problem because I never said the substitute function is a regex.
- svnpenn 4y agohttps://news.ycombinator.com/item?id=31804367 https://news.ycombinator.com/item?id=31804367
- ethanwillis 4y agoDo you not know what the word class means in this context?
- svnpenn 4y agoIf "a class of" means "a subsection of" (replace "subsection" with whatever word you feel is semantically correct), then your comment is wrong. A substitute command is just that, a command. It is not, and never has been a regex, or any part of it. Heres some headings to help you understand: ## Parts of regex . [a-z] $ ## items that use regex m// s/// qr//
- ethanwillis 4y agoThat's not what it means at all, please read more closely and get it together. You won't learn much by reacting this poorly to things you don't understand. Remember when I said A subset of regexes (that OP showed) from the total class of regexes that I mentioned in my comment are: This clearly implies that a "subset" or "subsection" is not the same as a class. I well defined in multiple ways what I meant by class while you continue to bury your head in the sand.