Rolf wrote: > Harold Hallikainen wrote: > > After the recent discussion of regular expressions, I, of course, today > > ran in to an application for them, but I have to do this in C30 for a > > PIC24. I need to change a relative URL (given the base URL) to an absolute > > URL. Everything I'm finding is pretty much using regular expressions in > > perl or PHP. Anyone have any other ideas? > > RegEx libraries are not the sort of thing you port just for one place to > use it.... the libraries are huge. The Java 'Pattern' class is in excess > of 5.5K lines, and uses many other classes... and it needs the matcher, > and other classes to get things to work. I would be somwhat surprised if > a mostly complete regex engine could fit in any PIC... and the effort > involved in harvesting a subset of regex functionality would be daunting.... Wow, talk about code bloat! Although I'm sure it's wonderful.... As a counterexample, I have the full source for a UNIX-style 'grep' command (dating from 1985) that clocks in at just over 400 lines of ordinary C code (9KB), including command-line handling, RE compiler, RE evaluator and results formatting. The x86 executable (for DOS) is 11KB. I'm sure this would port quite readily to C30. Of course, this is just the pattern matcher, and doesn't include any text replacement functionality. But if you make the right enhancements to the evaluation engine to capture the beginning and ending points of matches, adding replacement should be fairly straightforward. -- Dave Tweed -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist