On Mon, Aug 9, 2010 at 5:38 PM, Noufal Ibrahim <nou...@gmail.com> wrote:
> > [...] > > > Does anyone think something of this sort would be of wider use? Do you > > know already existing packages that can do it? What are the > > limitations that you see to this approach? Does anyone think, having > > the declarative string in code, would make it more maintainable? > > [...] > > I don't want to rain on your parade but I don't think this will be > useful. > > Regular expressions are mathematically sound ways of representing state > machines. They unambiguous and clean. They were brought into the whole > "programming" universe as a tool to do text processing and then > unleashed upon the unwashed masses leading them to use it for everything > from looking for a string in a file to parsing XML. The problem now is > that we have too much of this line noise in our programs and there have > been efforts to "clean it up" by using more "readable syntax". There was > even one floating about a few months ago which used XML to describe > regexps. I don't want to try to write an example. > > One of the things about regular expressions which makes them powerful is > their brevity and compactness. This of course leads to sometimes > unreadable code, abuse etc. but all of those are discipline issues which > should be addressed by simply using less regexps and using other things > which are more suited to the task (plain string indexing, parsers etc.). > > I think an attempt to create a more "friendly regexp format" which is > more readable is going the way of COBOL with it's "ADD 1 to X" rather > than x+=1. > > However, it's an interesting idea to make this work. I'd like to do the > reverse. Given a regexp, break it down into English for me so that I can > figure out what it's trying to do quickly. > > --- Hi, Thanks for the view. I do agree with you that as the regex becomes overly complex, this textual representation may also become equally complex..or more so. Here's a website to find out 'quickly' what a regular expression means: http://rick.measham.id.au/paste/explain.pl Best regards, Vishal _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers