Thread: Regex examples
View Single Post
Old 10-11-2014, 11:53 PM   #430
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by signum View Post
In my opinion, I don't think it's possible to write a single regular expression to do what you want. REs are not a general programming language and are quite limited in some respects. I wrote a short program to step through an htm file and find the number of ldquos, rdquos and quots in each paragraph. If the number of ldquos didn't equal the number of rdquos or the number of quots was odd, it adds a class="unbal" to the paragraph. Regular expressions are usually incapable of counting, comparing two registers or taking the modulus of a number. I would be pleased to be shown wrong, using the RE syntax in Sigil.
That is also a different case.

Note that my, WORKING, solution is not a true regular expression either. But regular expressions are not nearly as useful as regex+lookaround, so it was decided that regular expressions need not in fact be regular.
eschwartz is offline   Reply With Quote