Skip navigation.
 
mlRe: Regular Expressions?
FROM : David Hoerl
DATE : Fri Jun 06 18:16:36 2008

>dream cat7 wrote:

>>

>  > I agree that to be able to use that syntax is highly desirable, and

>>  indeed missing from all the cocoa libraries that I have looked at. One
>>  way would be a category addition to NSString class, which would call
>>  the  perl -pe 's/\b(.*?)/\u\L$1/g' for you and return the result as an
>>  NSString...
>>
>>  But unfortunately nobody has come up that type of an extension to
>>  NSString yet.
>>  Or are there and c-libraries that will accept this s//// syntax ?



Well, Terry Jones wrote a routine called "strsed" in 1990 that in
fact does this:

http://www.jones.tc/personal/odds-and-ends.html

It was loosely modeled on sed(1). It's a C routine that has this format:

str = strsed(string, command, option);

The strings is something like "Hello world". The command is of the form:

s/search/replace/ or g/search/replace/

The "s" version finds the first match and replaces it. The "g"
version finds and replaces every occurrence. It uses the regex(3)
library.

That's the good part. The bad part is that uses the older simpler
regex capability. I'm in the process of modernizing this code to use
the POSIX mode of regex(3), and hope to have it done next week. I
will eventually put it on my not-yet-done web site and support it
(maybe a small ObjC class for use with the icu library too).

In the mean time, email me if you want version 1 (couple of days). It
will be released with a very permissive license as the base code was
totally open source.

David

Related mailsAuthorDate
mlRegular Expressions? Cemil Browne Jun 6, 09:31
mlRe: Regular Expressions? Bob Warwick Jun 6, 09:55
mlRe: Regular Expressions? Bob Warwick Jun 6, 10:01
mlRe: Regular Expressions? David Troy Jun 6, 10:01
mlRe: Regular Expressions? Bill Bumgarner Jun 6, 10:08
mlRe: Regular Expressions? Citizen Jun 6, 10:11
mlRe: Regular Expressions? Cemil Browne Jun 6, 10:22
mlRe: Regular Expressions? Hamish Allan Jun 6, 11:08
mlRe: Regular Expressions? Allison Newman Jun 6, 11:10
mlRe: Regular Expressions? dream cat7 Jun 6, 11:34
mlRe: Regular Expressions? Vincent E. Jun 6, 12:01
mlRe: Regular Expressions? Jason Stephenson Jun 6, 12:23
mlRe: Regular Expressions? dream cat7 Jun 6, 14:09
mlRe: Regular Expressions? Vincent E. Jun 6, 15:39
mlRe: Regular Expressions? Dave DeLong Jun 6, 15:53
mlRe: Regular Expressions? dream cat7 Jun 6, 16:28
mlRe: Regular Expressions? Jason Stephenson Jun 6, 16:45
mlRe: Regular Expressions? Jason Stephenson Jun 6, 17:02
mlRe: Regular Expressions? Jens Alfke Jun 6, 17:03
mlRe: Regular Expressions? glenn andreas Jun 6, 17:13
mlRe: Regular Expressions? Jason Stephenson Jun 6, 17:29
mlRe: Regular Expressions? Jens Alfke Jun 6, 17:41
mlRe: Regular Expressions? dream cat7 Jun 6, 18:10
mlRe: Regular Expressions? David Hoerl Jun 6, 18:16
mlRe: Regular Expressions? Vincent E. Jun 6, 19:27
mlRe: Regular Expressions? James Montgomerie Jun 6, 20:19
mlRe: Regular Expressions? Jens Alfke Jun 6, 23:29
mlRe: Regular Expressions? Stephen J. Butler Jun 6, 23:47
mlRe: Regular Expressions? John C. Randolph Jun 7, 02:19
mlRe: Regular Expressions? Ilan Volow Jun 7, 12:41
ml3rd Party Nonsense (was Re: Regular Expressions?) Jason Stephenson Jun 7, 16:43
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Ken Ferry Jun 7, 18:59
mlRe: Regular Expressions? John Engelhart Jun 7, 19:07
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Kyle Sluder Jun 7, 19:24
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Kevin Grant Jun 7, 19:37
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) glenn andreas Jun 7, 20:01
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Michael Ash Jun 7, 20:27
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Torsten Curdt Jun 8, 00:44
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Mark Munz Jun 8, 01:19
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Michael Ash Jun 8, 12:39
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Jens Alfke Jun 10, 05:12
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Jens Alfke Jun 10, 05:17
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Adam R. Maxwell Jun 10, 05:56
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Mark Munz Jun 10, 06:12
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Stuart Malin Jun 10, 06:36
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Michael Ash Jun 10, 07:38
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Chris Ridd Jun 10, 16:16
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Jens Alfke Jun 10, 17:20
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Michael Ash Jun 10, 18:40
mlRe: 3rd Party Nonsense (was Re: Regular Expressions?) Alastair Houghton Jun 13, 13:36