Re: Why is / a metachar in regular expressions ?

2019-09-21 Thread Gabriel Zachmann via Cocoa-dev
>> >> Yeah, I'm inclined to think it's an error in the docs. > > If you look at the input expression in this great site, you'll see 2 /'s as > part of it. They mark the beginning and the end (before flags). > > https://regexr.com > OTOH, the doc of NSRegularExpression specifically links to

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Saagar Jha via Cocoa-dev
If you need any more confirmation, Swift’s NSRegularExpression escapes this exact set of characters , so there isn’t an error in the

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Rick Mann via Cocoa-dev
Ah! So it is. Definitely not an error in the docs, assuming NSRegularExpression supports flags. > On Sep 18, 2019, at 14:54 , Steve Mills via Cocoa-dev > wrote: > > On Sep 18, 2019, at 16:50:39, Rick Mann via Cocoa-dev > wrote: >> >> Yeah, I'm inclined to think it's an error in the docs. >

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Steve Mills via Cocoa-dev
On Sep 18, 2019, at 16:50:39, Rick Mann via Cocoa-dev wrote: > > Yeah, I'm inclined to think it's an error in the docs. If you look at the input expression in this great site, you'll see 2 /'s as part of it. They mark the beginning and the end (before flags). https://regexr.com -- Steve

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Rick Mann via Cocoa-dev
Yeah, I'm inclined to think it's an error in the docs. > On Sep 18, 2019, at 14:43 , Gabriel Zachmann via Cocoa-dev > wrote: > >>> I don't see why / is a meta character. >>> It does not appear anywhere else in the documentation as metacharacter. >> >> In some languages "/" is used as the

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Gabriel Zachmann via Cocoa-dev
>> I don't see why / is a meta character. >> It does not appear anywhere else in the documentation as metacharacter. > > In some languages "/" is used as the delimiter to begin/end a regular > expression, for example in sed where the substitution command is "s/old/new/". Right, good point -

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Rick Mann via Cocoa-dev
Is it used to refer to groups in text replacement? Sometimes that's a dollar sign, sometimes a slash, but I thought it was a backslash. > On Sep 18, 2019, at 13:51 , Jens Alfke via Cocoa-dev > wrote: > > > >> On Sep 18, 2019, at 1:45 PM, Gabriel Zachmann via Cocoa-dev >> wrote: >> >> I

Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Jens Alfke via Cocoa-dev
> On Sep 18, 2019, at 1:45 PM, Gabriel Zachmann via Cocoa-dev > wrote: > > I don't see why / is a meta character. > It does not appear anywhere else in the documentation as metacharacter. In some languages "/" is used as the delimiter to begin/end a regular expression, for example in sed

Why is / a metachar in regular expressions ?

2019-09-18 Thread Gabriel Zachmann via Cocoa-dev
In the doc for NSRegularExpression, it says "Characters that must be quoted to be treated as literals are * ? + [ ( ) { } ^ $ | \ . / " I don't see why / is a meta character. It does not appear anywhere else in the documentation as metacharacter. (Also not at

Re: SETUP : Regular Expressions - Easy Setup for RegexKitLite

2010-05-18 Thread Scott Ribe
On May 15, 2010, at 6:02 PM, Jens Alfke wrote: FYI, you don’t have to edit the linker flags anymore to do this. In Xcode 3.1+ you can open the target inspector, choose the General tab, and click the + button at the bottom left to pop up a list of available libraries. Then choose

SETUP : Regular Expressions - Easy Setup for RegexKitLite

2010-05-15 Thread Bill Hernandez
I've been using RegexKitLite for regular expressions for a little while, and the other day when I went to add it to another project, I had forgotten about the project setup. I was getting debugging errors, and finally remembered that I had to add -licucore to the other linker flags. I decided

Re: SETUP : Regular Expressions - Easy Setup for RegexKitLite

2010-05-15 Thread Jens Alfke
On May 15, 2010, at 2:15 PM, Bill Hernandez wrote: finally remembered that I had to add -licucore to the other linker flags. I decided to make a few screen captures (10) that make it really easy to see the small change that needs to be made to each project that uses regular expressions

Re: SETUP : Regular Expressions - Easy Setup for RegexKitLite

2010-05-15 Thread Bill Hernandez
On May 15, 2010, at 7:02 PM, Jens Alfke wrote: FYI, you don’t have to edit the linker flags anymore to do this. In Xcode 3.1+ you can open the target inspector, choose the General tab, and click the + button at the bottom left to pop up a list of available libraries. Then choose

Regular Expressions

2010-02-22 Thread Philip Juel Borges
Hi, Xcode supports the use of regular expressions. With the following search and replace I can find a string, like John 17:17, and turn it into a link: Find ([a-z]+) ([0-9]+):([0-9]+) Replace a href=file:///Library/\1/\2.html#\3\1 \2:\3/a This works fine. But right after Library I want

Re: Regular Expressions

2010-02-22 Thread Dave DeLong
, Xcode supports the use of regular expressions. With the following search and replace I can find a string, like John 17:17, and turn it into a link: Find ([a-z]+) ([0-9]+):([0-9]+) Replace a href=file:///Library/\1/\2.html#\3\1 \2:\3/a This works fine. But right after Library I want

Re: Regular Expressions

2010-02-22 Thread Jens Alfke
If you need more flexibility, you can write a short script in a language like Ruby, Perl or Python to do it. The advantage is that you can use arbitrarily powerful string and logical operators to transform the match string before replacing it. Perl and Ruby both have a command-line flag that

NSString and Regular Expressions

2009-12-14 Thread Phil Hystad
I was sort of suspecting that regular expression matches would be supported by NSString yet I find no message interface for supporting regular expressions. So, is the only capability for handling regular expressions in Objective-C the Posix Regex library? phil phys...@mac.com

Re: NSString and Regular Expressions

2009-12-14 Thread Dave DeLong
Cheers, Dave On Dec 14, 2009, at 3:34 PM, Phil Hystad wrote: I was sort of suspecting that regular expression matches would be supported by NSString yet I find no message interface for supporting regular expressions. So, is the only capability for handling regular expressions

Re: NSString and regular expressions

2009-08-03 Thread BareFeet
Hi All, RegexKitLite looks promising. It claims to only require you to add the .h and .m file to your project and link to the libicucore.dylib library. I managed to incorporate RegexKitLite fairly easily once I found in the documentation the steps to link to the libicucore.dylib library.

AGRegex (was: NSString and regular expressions)

2009-08-03 Thread BareFeet
Hi all, Has anyone got procedure for getting AGRegex to work in their project? Thanks, Tom BareFeet From: BareFeet list.develo...@tandb.com.au Date: 31 July 2009 9:03:20 AM AEST To: Cocoa Dev Cocoa-dev@lists.apple.com Subject: Re: NSString and regular expressions Hi Rob, I personally

Re: AGRegex (was: NSString and regular expressions)

2009-08-03 Thread Rick Mann
:03:20 AM AEST To: Cocoa Dev Cocoa-dev@lists.apple.com Subject: Re: NSString and regular expressions Hi Rob, I personally just compile the files directly into my project. You need AGRegex.h and AGRegex.m but you should only compile the following files from the pcre distribution

Re: AGRegex (was: NSString and regular expressions)

2009-08-03 Thread Adam R. Maxwell
On Aug 3, 2009, at 8:15 PM, BareFeet wrote: Has anyone got procedure for getting AGRegex to work in their project? I've used AGRegex.framework in a number of projects, but it's been so long that I've no idea what steps I went through to set it up. The copy here

Re: NSString and regular expressions

2009-07-31 Thread Alastair Houghton
On 31 Jul 2009, at 01:04, BareFeet wrote: The documentation notes: Warning: Apple does not officially support linking to the libicucore.dylib library. In reality, how worried should I be about this? I wouldn't lose much sleep over it, to be honest, as long as you stick to ICU's C API (as

Re: NSString and regular expressions

2009-07-31 Thread Alastair Houghton
On 31 Jul 2009, at 01:18, Charles Srstka wrote: ICU is an open-source project, so if you're concerned about the Apple-supplied one disappearing, you can just go download the latest sources, compile it yourself, and then either link it statically or include the dylib inside your bundle.

Re: NSString and regular expressions

2009-07-31 Thread Jean-Daniel Dupas
Le 31 juil. 09 à 11:30, Alastair Houghton a écrit : On 31 Jul 2009, at 01:04, BareFeet wrote: The documentation notes: Warning: Apple does not officially support linking to the libicucore.dylib library. In reality, how worried should I be about this? I wouldn't lose much sleep over it,

Re: NSString and regular expressions

2009-07-31 Thread Alastair Houghton
On 31 Jul 2009, at 15:30, Jean-Daniel Dupas wrote: Le 31 juil. 09 à 11:30, Alastair Houghton a écrit : As far as I understood, the original reason for not providing the headers was that the C++ ABI was not stable and so a program linked against ICU on one version of Mac OS X might not work

Re: NSString and regular expressions

2009-07-31 Thread John Engelhart
not by Apple. Apple actually refers to the ICU documentation in certain parts of its official documentation (NSPredicate wrt/ regular expressions and the MATCHES operator). So, it comes down to a matter of opinion and a judgement call. Considering how easy it is to create a location in the file system

Re: NSString and regular expressions

2009-07-30 Thread BareFeet
Hi Rob all, On 28/07/2009, at 11:02 AM, Rob Keniger wrote: You might want to look at AGRegex which is very compact (one class) and which uses PCRE: http://colloquy.info/project/browser/trunk/Frameworks/AGRegex Thanks for the tip. Have you been able to get this to work? Do we add the

Re: NSString and regular expressions

2009-07-30 Thread Rob Keniger
On 30/07/2009, at 2:51 PM, BareFeet wrote: You might want to look at AGRegex which is very compact (one class) and which uses PCRE: http://colloquy.info/project/browser/trunk/Frameworks/AGRegex Thanks for the tip. Have you been able to get this to work? Do we add the framework or the

Re: NSString and regular expressions

2009-07-30 Thread John Engelhart
On Mon, Jul 27, 2009 at 9:02 PM, Rob Keniger r...@menumachine.com wrote: On 28/07/2009, at 10:38 AM, Dave DeLong wrote: RegexKit. Without a doubt. http://regexkit.sourceforge.net I use it in about 75% of my projects. RegexKit is very nice and extremely comprehensive, but it has quite

Re: NSString and regular expressions

2009-07-30 Thread BareFeet
Hi Rob, I personally just compile the files directly into my project. You need AGRegex.h and AGRegex.m but you should only compile the following files from the pcre distribution: pcre_chartables.c pcre_compile.c pcre_exec.c pcre_fullinfo.c pcre_get.c pcre_globals.c pcre_info.c

Re: NSString and regular expressions

2009-07-30 Thread BareFeet
Hi John and all, You might want to look at AGRegex which is very compact (one class) and which uses PCRE: http://colloquy.info/project/browser/trunk/Frameworks/AGRegex Of note, Colloquy appears to have switched to RegexKitLite itself: http://svn.colloquy.info/project/changeset/4301 I

Re: NSString and regular expressions

2009-07-30 Thread Charles Srstka
On Jul 30, 2009, at 7:04 PM, BareFeet wrote: RegexKitLite looks promising. It claims to only require you to add the .h and .m file to your project and link to the libicucore.dylib library. The documentation notes: Warning: Apple does not officially support linking to the libicucore.dylib

Re: NSString and regular expressions

2009-07-28 Thread Alastair Houghton
On 28 Jul 2009, at 02:02, Rob Keniger wrote: On 28/07/2009, at 10:38 AM, Dave DeLong wrote: RegexKit. Without a doubt. http://regexkit.sourceforge.net I use it in about 75% of my projects. RegexKit is very nice and extremely comprehensive, but it has quite a large footprint and is

Re: NSString and regular expressions

2009-07-28 Thread jonat...@mugginsoft.com
have to actually *implement* Perl to do it). NSPredicate anyone? The MATCHES operator uses ICU's Regular Expressions package. http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pUsing.html#/ /apple_ref/doc/uid/TP40001794-SW9 Kind regards, Alastair. -- http

NSString and regular expressions

2009-07-27 Thread Rick Mann
I need to do some regex searches on NSStrings, and use capturing groups. Looking online I found some discussions from 2003 referring to MOKit, which hasn't been touched since 2005, and seems to include a lot of stuff I don't care about. Other references to agkit suggest it doesn't support

Re: NSString and regular expressions

2009-07-27 Thread Dave DeLong
RegexKit. Without a doubt. http://regexkit.sourceforge.net I use it in about 75% of my projects. Dave On Jul 27, 2009, at 6:37 PM, Rick Mann wrote: I need to do some regex searches on NSStrings, and use capturing groups. Looking online I found some discussions from 2003 referring to

Re: NSString and regular expressions

2009-07-27 Thread Rob Keniger
On 28/07/2009, at 10:38 AM, Dave DeLong wrote: RegexKit. Without a doubt. http://regexkit.sourceforge.net I use it in about 75% of my projects. RegexKit is very nice and extremely comprehensive, but it has quite a large footprint and is probably overkill for many uses. Unfortunately,

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-13 Thread Alastair Houghton
On 10 Jun 2008, at 15:16, Chris Ridd wrote: On 10 Jun 2008, at 05:12, Mark Munz wrote: Just wishing for the problem to go away or blaming external criteria will almost guarantee that nothing gets done. Filing bugs is how you, the developer, communicate your needs to Apple. Since ICU is open

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-10 Thread Chris Ridd
On 10 Jun 2008, at 05:12, Mark Munz wrote: Just wishing for the problem to go away or blaming external criteria will almost guarantee that nothing gets done. Filing bugs is how you, the developer, communicate your needs to Apple. Since ICU is open source, the other productive thing to do

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-10 Thread Jens Alfke
On 9 Jun '08, at 10:38 PM, Michael Ash wrote: It's perfectly possible to write safe code that calls C str functions. My code is no more vulnerable than the next man's. You can call things like strnstr, pass the length of the NSData you're working on, and there is exactly zero risk of anything.

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-10 Thread Michael Ash
On Tue, Jun 10, 2008 at 8:20 AM, Jens Alfke [EMAIL PROTECTED] wrote: On 9 Jun '08, at 10:38 PM, Michael Ash wrote: It's perfectly possible to write safe code that calls C str functions. My code is no more vulnerable than the next man's. You can call things like strnstr, pass the length of

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-09 Thread Jens Alfke
On 7 Jun '08, at 10:24 AM, Kyle Sluder wrote: 1) There are certain basics like regex support that people are upset at Apple for not implementing because it seems like such an important part of the concept of strings. Agreed, and I made this argument many times while there. Part of the

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-09 Thread Jens Alfke
On 8 Jun '08, at 3:39 AM, Michael Ash wrote: I never cared about the lack of regex support personally, although I understand that people do use them. As far as a blessed solution goes, man regex gives you a library that's in libSystem and is part of POSIX, so it's as supported as you can get.

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-09 Thread Adam R. Maxwell
On Jun 9, 2008, at 8:12 PM, Jens Alfke wrote: On 7 Jun '08, at 10:24 AM, Kyle Sluder wrote: 1) There are certain basics like regex support that people are upset at Apple for not implementing because it seems like such an important part of the concept of strings. Agreed, and I made this

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-09 Thread Mark Munz
On 6/9/08, Adam R. Maxwell [EMAIL PROTECTED] wrote: Unfortunately, I think filing bug reports on this is a waste of time at this point. I'm still using AGRegex, which is based on a pretty ancient PCRE, but it's predated by (at least) MOKit and OFRegularExpression: Filing bugs against this

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-09 Thread Stuart Malin
On Jun 9, 2008, at 9:11 PM, Adam R. Maxwell wrote: I thought I read on the Xcode users list that Xcode is using ICU for regex find-and-replace, so it's too bad the rest of us can't use it. I recall the same. And further, I am of the understanding that NSPredicate uses ICU for its pattern

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-09 Thread Michael Ash
On Mon, Jun 9, 2008 at 8:17 PM, Jens Alfke [EMAIL PROTECTED] wrote: On 8 Jun '08, at 3:39 AM, Michael Ash wrote: I do this with a fair amount of regularity. NSString is unsuitable for working with data whose encoding is unknown or doubtful, and NSData doesn't have any string-like

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-08 Thread Michael Ash
is how easy it is to talk to these pure C libraries and get them to do work for you as well. Many folks see regular expressions as a core part of today's frameworks (.NET, Java, Ruby, Python). ObjC, admittedly, looks a bit anemic in this area. There is no blessed solution and so the developer

Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Allison Newman
I can't for the life of me imagine why you would think that. I mean, I'm not theorising here, I have actually done it. My very first Cocoa app was a RubyCocoa app, and my second, a true, full-featured app, is just about done. And you know what, I never did regret my decision to not really

Re: Regular Expressions?

2008-06-07 Thread Ilan Volow
What I found so useful about Cocoa-Java was that it was the perfect tool for easily writing Cocoa Apps that made heavy use of technologies that Apple was too short-sighted to add, largely because Java came out- of-the-box with so many useful classes for basic stuff like regular expressions

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Felipe Monteiro de Carvalho
On Sat, Jun 7, 2008 at 4:20 AM, Allison Newman [EMAIL PROTECTED] wrote: obj = [[SomeClass alloc] initWithName: @'my name' size: 16] to obj = SomeClass.alloc.initWithName_size('my name', 16) And in Pascal: obj := SomeClass.initWithName_size('my name', 16); (alloc is called automatically)

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 8:20 AM, Allison Newman [EMAIL PROTECTED] wrote: Really, once you figure out how to translate obj = [[SomeClass alloc] initWithName: @'my name' size: 16] to obj = SomeClass.alloc.initWithName_size('my name', 16) you're ready to start programming with RubyCocoa

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread David Troy
Syntactical transformations, especially those where semantic parity is retained, have never struck me as much of a barrier. I am new to Objective C (though not to C) and have had a lot of experience in Ruby, and I am struck by how structurally similar Objective C and Ruby actually are.

Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Jose Raul Capablanca
Allison Newman said: It's just that I can't help thinking about all of the comments that we see on this list from people coming from Java or some other language where header files aren't necessary, or which don't have pointers. They are confused by these things, and having to learn that

3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-07 Thread Jason Stephenson
Ilan Volow wrote: Back in the Jaguar-era when I had to write applications that made heavy use of XML and regular expressions, Cocoa-Java saved the day--no 3rd-party nonsense required. This in not a knock on Ilan. His mail just happens to embody an attitude that I see quite frequently

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-07 Thread Ken Ferry
heavy use of XML and regular expressions, Cocoa-Java saved the day--no 3rd-party nonsense required. This in not a knock on Ilan. His mail just happens to embody an attitude that I see quite frequently on this list, and I just feel that I have to share my puzzlement at this negative attitude

Re: Regular Expressions?

2008-06-07 Thread John Engelhart
On Jun 6, 2008, at 1:27 PM, Vincent E. wrote: When I mentioned perl -pe 's/\b(.*?)/\u\L$1/g' I actually wasn't asking for any ObjC method with a look-alike syntax. I actually wouldn't give a damn about how (s///g) to pass a regex pattern to a method. ;) I was rather asking whether

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-07 Thread Kyle Sluder
On Sat, Jun 7, 2008 at 10:43 AM, Jason Stephenson [EMAIL PROTECTED] wrote: As someone who has worked on a number of 3rd party [open source and otherwise] frameworks, I wonder where this attitude comes from in the case of Cocoa/Mac OS X. I have some ideas, but I hesitate to share them. Four

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-07 Thread glenn andreas
On Jun 7, 2008, at 12:37 PM, Kevin Grant wrote: It is possible to link your application through C to an interpreter like Python or Perl, and rely on the built-in regular expression libraries to do your work. If you really wanted to, you could fire off a call to /usr/bin/egrep. That last

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Felipe Monteiro de Carvalho
On Sat, Jun 7, 2008 at 11:38 AM, Jose Raul Capablanca [EMAIL PROTECTED] wrote: With the exception of the id and SEL types, categories, and the fact that you can send messages to nil, I can't think of anything in Obj-C that isn't done better in Java, Here is one: Integration with other

Re: Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread WT
of a large library base is also true of Java. Since every copy of OS X comes with Java built-in, one has access to a large number of well-tested libraries. Case in point: dealing with regular expressions (a recent hot topic in this list). I don't mean to make a case explicitly for Java (or to make

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread WT
On Jun 7, 2008, at 9:01 PM, Felipe Monteiro de Carvalho wrote: On Sat, Jun 7, 2008 at 11:38 AM, Jose Raul Capablanca [EMAIL PROTECTED] wrote: With the exception of the id and SEL types, categories, and the fact that you can send messages to nil, I can't think of anything in Obj-C that

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread John C. Randolph
I didn't say not to use Ruby if you want. What I took exception to is your statement that you don't have to fully learn Objective-C's syntax at the same time as Cocoa. Use whatever language you like, but if you're going to use Cocoa, you'd *better* learn Objective-C. -jcr

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread John C. Randolph
On Jun 7, 2008, at 7:38 AM, Jose Raul Capablanca wrote: I never understood why Apple stopped supporting the Java bridge to Cocoa. Two reasons: First, not enough people were using it to make it cost- effective to maintain, and second, it was sucking up a lot of development time when new

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-07 Thread Torsten Curdt
snip/ Agree with your sentiments. Not everything needs to be shipped by default. The only other environment where I've programmed that this same attitude may rear its head could be Java land, but even there that attitude does not seem to rear its head quite so often as it seems to on

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Philippe Mougin
Le 7 juin 08 à 22:26, WT a écrit : I still don't see any good-enough *technical* reason to justify basing Cocoa on an extension of C, however. That's all I've been trying to say. WT, I think this is an interesting question (as are your other comments), and I think I have the answer :-)

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Torsten Curdt
Here is one: Integration with other languages Java's integration with other languages (as using Java libraries in other languages) is about one of the worse I've ever seen. It basically makes any Java library accessible to only Java. Yepp - the integration sucks but... And a second one:

Re: 3rd Party Nonsense (was Re: Regular Expressions?)

2008-06-07 Thread Mark Munz
to do work for you as well. Many folks see regular expressions as a core part of today's frameworks (.NET, Java, Ruby, Python). ObjC, admittedly, looks a bit anemic in this area. There is no blessed solution and so the developer is required to research each of the many libraries to consider

Regular Expressions?

2008-06-06 Thread Cemil Browne
Hi all, This might be a really silly question - but am I missing something obvious? Is there any support at all for regular expressions in the Cocoa libraries? I can't find anything and I've found some third-party frameworks - but surely something so necessary must be buried in the string

Re: Regular Expressions?

2008-06-06 Thread Bob Warwick
On 6-Jun-08, at 4:31 AM, Cemil Browne wrote: Hi all, This might be a really silly question - but am I missing something obvious? Is there any support at all for regular expressions in the Cocoa libraries? I can't find anything and I've found some third-party frameworks - but surely

Re: Regular Expressions?

2008-06-06 Thread David Troy
, 2008, at 3:55 AM, Bob Warwick wrote: On 6-Jun-08, at 4:31 AM, Cemil Browne wrote: Hi all, This might be a really silly question - but am I missing something obvious? Is there any support at all for regular expressions in the Cocoa libraries? I can't find anything and I've found some third

Re: Regular Expressions?

2008-06-06 Thread Bob Warwick
documentation. It creates a new string with the substring replaced. -Bob Warwick [EMAIL PROTECTED] On 6-Jun-08, at 4:31 AM, Cemil Browne wrote: Hi all, This might be a really silly question - but am I missing something obvious? Is there any support at all for regular expressions

Re: Regular Expressions?

2008-06-06 Thread Bill Bumgarner
On Jun 6, 2008, at 1:01 AM, David Troy wrote: Depending on what you're doing you could try using Ruby Cocoa. In theory this should give you access to all of Ruby's internal regexp support, combined with the GUI goodness of Cocoa. However, this has limitations of its own, such as

Re: Regular Expressions?

2008-06-06 Thread Citizen
If you are not married to using regular expressions, NSScanner can do much the same in a more verbose (generally easier to read) way. I only mention this because it is often overlooked. On 6 Jun 2008, at 08:31, Cemil Browne wrote: Hi all, This might be a really silly question - but am I

Re: Regular Expressions?

2008-06-06 Thread Cemil Browne
regardless. Thanks all, -Cemil On Fri, Jun 6, 2008 at 6:11 PM, Citizen [EMAIL PROTECTED] wrote: If you are not married to using regular expressions, NSScanner can do much the same in a more verbose (generally easier to read) way. I only mention this because it is often overlooked. On 6 Jun 2008

Re: Regular Expressions?

2008-06-06 Thread Hamish Allan
On Fri, Jun 6, 2008 at 8:31 AM, Cemil Browne [EMAIL PROTECTED] wrote: This might be a really silly question - but am I missing something obvious? Is there any support at all for regular expressions in the Cocoa libraries? You can use NSPredicate for regexp matching, though no substitution

Re: Regular Expressions?

2008-06-06 Thread Allison Newman
On Friday, June 06, 2008, at 10:24AM, [EMAIL PROTECTED] wrote: As big of a fan as I am of both RubyCocoa and PyObjC, I would never recommend either of them for use by someone relatively new to Cocoa (of which it sounds like the OP might be). Even with the awesome quality of the bridges --

Re: Regular Expressions?

2008-06-06 Thread dream cat7
://regexkit.sourceforge.net/ appears to be decent. NSScanner does not really appear to do what I'm looking for - but is useful to know about regardless. Thanks all, -Cemil On Fri, Jun 6, 2008 at 6:11 PM, Citizen [EMAIL PROTECTED] wrote: If you are not married to using regular expressions, NSScanner

Re: Regular Expressions?

2008-06-06 Thread Vincent E.
for - but is useful to know about regardless. Thanks all, -Cemil On Fri, Jun 6, 2008 at 6:11 PM, Citizen [EMAIL PROTECTED] wrote: If you are not married to using regular expressions, NSScanner can do much the same in a more verbose (generally easier to read) way. I only mention this because it is often

Re: Regular Expressions?

2008-06-06 Thread Jason Stephenson
systems. I've even made some simple classes for using the lib in Cocoa. Admittedly the interface is a bit schizoid, but I'll email it to you if you're interested in looking at it. I've looked at RegexKit and it looks good if you want Perl compatible regular expressions. The license isn't bad, so

Re: Regular Expressions?

2008-06-06 Thread dream cat7
about regardless. Thanks all, -Cemil On Fri, Jun 6, 2008 at 6:11 PM, Citizen [EMAIL PROTECTED] wrote: If you are not married to using regular expressions, NSScanner can do much the same in a more verbose (generally easier to read) way. I only mention this because it is often overlooked

Re: Regular Expressions?

2008-06-06 Thread Vincent E.
Right, but that's a very trivial string replacement with no advanced modifications. I had thing like this perl script for changing case to word caps in mind: echo 'some test text' | perl -pe 's/\b(.*?)/\u\L$1/g' search pattern would be \b(.*?) replacement pattern would be \u\L$1 I would

Re: Regular Expressions?

2008-06-06 Thread Dave DeLong
support at all for regular expressions in the Cocoa libraries? I can't find anything and I've found some third-party frameworks - but surely something so necessary must be buried in the string classes somewhere? How would I do a simple substring search or replace in 10.4? Thanks, Cemil

Re: Regular Expressions?

2008-06-06 Thread dream cat7
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

Re: Regular Expressions?

2008-06-06 Thread Jason Stephenson
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

Re: Regular Expressions?

2008-06-06 Thread Jens Alfke
On 6 Jun '08, at 3:23 AM, Jason Stephenson wrote: As a long time UNIX programmer, I'll suggest looking into the regexp library that already comes with OS X. man regcomp on the command line to find out how to use. It doesn't look as though this library is Unicode-aware. The strings it

Re: Regular Expressions?

2008-06-06 Thread Jason Stephenson
glenn andreas wrote: [wrote about how using regex is not a good idea, particularly with NSString and unicode. Pretty much the same things that Jens wrote earlier.] Yes, that's all very true. Regex is a poor choice if you're working on non-ASCII text. I'm generally not doing so, but just

Re: Regular Expressions?

2008-06-06 Thread Jens Alfke
On 6 Jun '08, at 8:02 AM, Jason Stephenson wrote: I have yet to find a regex library that handles UTF-16 well, if at all. I actually spent a couple of hours yesterday trying to mangle some UTF-16 files in Perl using regular expressions. I gave up and did it in Emacs, the only environment

Re: Regular Expressions?

2008-06-06 Thread dream cat7
to find a regex library that handles UTF-16 well, if at all. I actually spent a couple of hours yesterday trying to mangle some UTF-16 files in Perl using regular expressions. I gave up and did it in Emacs, the only environment where I've seen REs handle UTF16 properly. So, that's now my

Re: Regular Expressions?

2008-06-06 Thread David Hoerl
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

Re: Regular Expressions?

2008-06-06 Thread James Montgomerie
On 6 Jun 2008, at 08:03, Jens Alfke wrote: On 6 Jun '08, at 3:23 AM, Jason Stephenson wrote: As a long time UNIX programmer, I'll suggest looking into the regexp library that already comes with OS X. man regcomp on the command line to find out how to use. It doesn't look as though this

Re: Regular Expressions?

2008-06-06 Thread Jens Alfke
-ASCII characters, etc... JavaScriptCore is just using PCRE*. That basically supports Unicode, but I have had problems in the past with non-Roman text in JS regular expressions (particularly with word breaks in Japanese text). I think ICU is a better bet. —Jens * and until a month or two ago

Re: Regular Expressions?

2008-06-06 Thread Stephen J. Butler
On Fri, Jun 6, 2008 at 10:13 AM, glenn andreas [EMAIL PROTECTED] wrote: One other possible solution is to use the JavaScriptCore and make a JSStringRef (which works with unichars like NSString), and use JavaScript's regex support - that way the results will at least have consistent indices,

Re: Regular Expressions?

2008-06-06 Thread John C. Randolph
On Jun 6, 2008, at 2:10 AM, Allison Newman wrote: you don't have to fully learn Objective C's syntax at the same time as Cocoa. Ok, all kinds of alarm bells just went off. Obj-C is a very small delta from C, and if you avoid learning it, you will regret it. -jcr