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 say
(([a-z]{2})[a-z]*) ([0-9]+):([0-9]+)
The name of the book is in \1, the first two letters are in \2, and then the
reference is in \3:\4
However, this does require that the name of the book be at least two letters
long.
Dave
On Feb 22, 2010, at 8:08 AM, Philip Juel Borges wrote:
> Hi,
>
> Xc
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
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 le
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.
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 woul
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 f
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 m
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 t
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 argu
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.
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
probl
On Sat, Jun 7, 2008 at 7:19 PM, Mark Munz <[EMAIL PROTECTED]> wrote:
> On 6/7/08, Michael Ash <[EMAIL PROTECTED]> wrote:
>
>> Of course Mac OS X does come with a regex library, it just doesn't
>> have an ObjC interface. There's more to what's available than Cocoa,
>> and one of the great things
On 6/7/08, Michael Ash <[EMAIL PROTECTED]> wrote:
> Of course Mac OS X does come with a regex library, it just doesn't
> have an ObjC interface. There's more to what's available than Cocoa,
> and one of the great things about ObjC is how easy it is to talk to
> these pure C libraries and get t
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 this li
On Sat, Jun 7, 2008 at 10:43 AM, Jason Stephenson <[EMAIL PROTECTED]> wrote:
> It seems that many on this list feel that Apple should provide everything
> that the programmer needs to work on Mac OS X and that there should not be
> 3rd party frameworks for much of anything.
>
> This attitude really
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 one
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.
These are all part of the default Mac OS X platform, they
require
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
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
In math, a result is 'elegant' if it just _does_ something, simply and
quickly, rather than relying on a mass of machinery done elsewhere,
that you either have to assume works or spend time understanding. A
large dependency can make it harder to say what, exactly, are the key
lynchpins that make t
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 on thi
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.
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
__
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,
On 6 Jun '08, at 8:13 AM, glenn andreas 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, work well with non-ASCI
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 lib
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 RegExKit (or even RegExKitLite?) would
generally
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 resu
... pcre takes utf8 strings
... utf-16 is supported by RegexKitLite & lib ICU
... NSString and CFString are implemented as utf-16
On 6 Jun 2008, at 16:02, Jason Stephenson wrote:
Replying to myself here, which I know is generally a bad thing, but
this thought just came to me.
I have yet to
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 w
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 yeste
On Jun 6, 2008, at 5:23 AM, Jason Stephenson wrote:
Hi,
You've gotten a lot of decent answers so far.
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.
Note that NSStrings ar
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 take
Replying to myself here, which I know is generally a bad thing, but this
thought just came to me.
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
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
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..
I've used OgreKit before and found it's worked pretty well.
http://www8.ocn.ne.jp/%7esonoisa/OgreKit/index.html
Dave
On Fri, Jun 6, 2008 at 1:31 AM, Cemil Browne <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> This might be a really silly question - but am I missing something obvious?
> Is there any s
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 wo
No that would require finding rangeOfRegex followed by a call to
replaceCharactersInRange
NSRange range = [theString rangeOfRegex:@"regex" capture:0];
if( ! NSEqualRanges(range, ((NSRange){NSNotFound, 0} )) )
[theString replaceCharacter
Hi,
You've gotten a lot of decent answers so far.
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.
I've used it for years in my C applications on UNIX and UNIX-like
operating sy
But RegexKitLite does not support substitution, does it?
Regex pattern matching is one thing, regex string substitution another.
On Jun 6, 2008, at 11:34 AM, dream cat7 wrote:
Perhaps also consider RegexKitLite, which is written by the same
author. The difference is it links to shared libicu
Perhaps also consider RegexKitLite, which is written by the same
author. The difference is it links to shared libicu thats already
distributed in the os. No need to embed some specific version of PCRE
library into your app included with the regexkit (saves ~1.6mb in the
bundle). Also the
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 bridge
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
Thanks to everyone who replied - I appreciate the help.
The best solution I've found (and been told) is to use a third party Regex
library - http://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
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 mi
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 distributio
Hello -
Whoops! I can read.
You use the replaceOccurrencesOfString:withString:options:range:
method in NSMutableString. It works on the same instance of the
string instead of creating a new string.
For example:
NSMutableString *someString = [NSMutableString stringWithS
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 distribution audience, speed, etc.
Dave
On Jun 6, 200
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 someth
51 matches
Mail list logo