Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A substitute command is a class of regexes.


> 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.)


Nope. Regular expressions define patterns, which people can then use to extract or transform text.


A 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.


I 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.


I 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 ;)


Nope. 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.


I'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.



Do you not know what the word class means in this context?


If "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//


That'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.


It seems you fail to understand what class means. Regardless of what you think it means, you're using it wrong. The command given in the example is:

    - not a regex
    - not a class of regex
    - not a part of regex in general
please educate yourself, as you seem to have trouble understanding the scope of what regex is.


Educate me on what you think a class is then? Because I think you're conflating it with a set, which it is not.


the example given was a command, not a regex, and not a class of regex

would you call an apple, a class of an orange?


You're refusing to define what a class is.. when I think the crux of the problem with this conversation is that we don't have the same definition. You think I'm using the word incorrectly. So please tell me what you think a "class" and what it is in relation to a "set/subsection"


there is no definition that you can attach to "class", that makes it correct for this usage, unless you want to change what the word means. Heres a good quote [1]:

> an expression /re/ can be used to specify a range of lines (matching the pattern), which can be combined with other commands

So the command contains a regex, but its not a regex itself, and its not a class of regex. Sorry, but you don't get to just say "well that's not my definition", and get out of it. Sometimes, you're just objectively wrong. It would be like saying you "donated" something, when you really "pledged" it.

1. https://wikipedia.org/wiki/Regular_expression#Delimiters


You still fail to define what a "class" is simply because you didn't and don't understand it still.

https://math.stackexchange.com/a/173002 here read up. Also read on Russell's Paradox. I'm not objectively wrong you're just uneducated and your ego is too large. The irony is I was saying the exact same thing you were in my very first comment, except with more precision.

And I still would want you to think about what exactly "output" is.


you seem pretty smart about math, and pretty dumb about regular expressions. Considering that I have a RegEx bronze badge [1], I think I will just trust my own judgment in this matter.

1. https://stackoverflow.com/help/badges/269/regex?userid=10022...


either bad troll or dense




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: