Earlier quoted context omitted.
The question is about identifying end-tags in XHTML. This is indeed possible with a regex.
">try this
Is there a regular expression to detect a valid regular expression?
111–120 of 224 posts
Re: Is there a regular expression to detect a valid regular expression?
#112Earlier quoted context omitted.
The question is about identifying end-tags in XHTML. This is indeed possible with a regex.
theoretically I believe an end tag really requires a valid start tag. anyway you can probably answer any number of simple questions about a bit of HTML using regex but as code wants to grow to handle more use cases there will come a time when the solution will break down and the code that wrote to handle all the previous uses will need to be rewritten using something other than regex.
Re: Is there a regular expression to detect a valid regular expression?
#113Earlier quoted context omitted.
Can regex engines actually process arbitrarily deep nestings themselves though? It seems to me it would start getting computationally expensive very quickly to search for those kinds of regexes, so is 'arbitrarily deep' a practical concern for todays hardware?
Just considering the language of balanced parentheses, the only memory needed is a single integer to track depth. If we see a "(", increment. If we see a ")", decrement. If we never go negative and end up with zero, that's a balanced parentheses expression. (To be clear, the parser I've described is not a regex parser.) Adding the rest of the regex machinery makes this a bit more complex, but in general, if the compu…
Re: Is there a regular expression to detect a valid regular expression?
#114> Is there a regular expression to detect a valid regular expression? No, there is not. For example, parentheses in a regex must be balanced, and (famously) there is no regex to detect balanced parentheses.
It depends on the representation. If the representation is in the FSA format (state, character, state), it becomes nearly trivial.
Re: Is there a regular expression to detect a valid regular expression?
#115Earlier quoted context omitted.
Are you sure you aren't mistaken? :-)
Go ahead - show me wrong.
With compilers - I just fix the bug myself. With humans, I have to convince the human to self-correct.
Common problem in distributed systems that - leader election.
Re: Is there a regular expression to detect a valid regular expression?
#116Re: Is there a regular expression to detect a valid regular expression?
#117Earlier quoted context omitted.
You are axiomatically assuming that the proposition "V determines well-formedness of any regular expressions" to be true. I am asking you to prove that. Constructively.
:-)
All models are wrong - some are useful.
Re: Is there a regular expression to detect a valid regular expression?
#118Re: Is there a regular expression to detect a valid regular expression?
#119So, given the much discussed limitations of reg-exps and the desire to parse context-free grammars. My question is, why are we still using regular expressions. Or rather, why isn't there something as easy to use as regular expressions that can processes context-free grammars?
[1] https://docs.perl6.org/language/grammars
[2] https://developer.ibm.com/open/projects/rosie-pattern-langua...
Re: Is there a regular expression to detect a valid regular expression?
#120Earlier quoted context omitted.
I don't know if it's possible to do the "string describing a set strings" thing that regex does with more powerful parsing while maintaining the ease of use. CFGs make heavy use of named sub-languages (productions). A regex-style parser would at least have to have some kind of recursion-inducing metacharacter.
How about this for ease-of-use? sentence --> noun_phrase, verb_phrase. noun_phrase --> det, noun. verb_phrase --> verb, noun_phrase. det --> [the]. det --> [a]. noun --> [cat]. noun --> [bat]. verb --> [eats]. Reads -and behaves- as BNF. Strings in []'s are terminals, the rest are nonterminals. It's directly executable as a logic program (it's Prolog syntactic sugar).