realbasic-nug
[Top] [All Lists]

Re: RegEx searching

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: RegEx searching
From: Peter Karlsson <lists at redpro dot se>
Date: Sat, 30 Dec 2006 14:39:10 +0100
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <221762 dot 7387 dot qm at web54110 dot mail dot yahoo dot com>
Hi Mark,

30 dec 2006 kl. 00.27 skrev Mark Nutter:


--- Peter Karlsson <lists at redpro dot se> wrote:

Hi,
Is there a way to get RegEx to give the character position of a

result as instr do? I've played with SubExpressionStartB but it
only
gives byte positions and that's not enough to select a word in
an
editfield if there's umlauts.

There's a feature request for this:

http://www.realsoftware.com/feedback/viewreport.php?reportid=ayizdwed

I've added it to my watchlist.



question 2:
is
rx.SearchPattern = "(\W)" + search + "(\W)"
the best pattern to find a word?

Depends on what you mean by "best".  Not to be flippant, but the
RegEx engine has its own idea of what a "word" is, which may not
match your idea.  For general purposes, the \b wildcard works
well as a word boundary marker, since it also matches beginning
or end of line as a word boundary, which \W won't.

I switched to \b and it seems to work very well, as do the workaround for SubExpressionStartB. Thanks everybody who helped.

Peter


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>