On 25 Mar 2007, at 6:14 PM, r99kay wrote:
> Hi everyone,
> I've got a field called ne_descr with text in brackets in it. Here are
> a few examples: STATE CIRCLE (STATWCAPINRM -> COMMONWEALTH (N) / STATE
> (E) RAMP) or CAPITAL (N) / STATE (S) RAMP
> I want to use the stringreplacer to get rid of anything in brackets
> (including the brackets) and replace it with nothing.
> I've tried using AREs but must have something wrong. Any suggestions?
I'm not 100% clear about what you want to get rid of in these
examples. What characters can be contained between the brackets? Do
you have a clear specification for what the values might look like?
I'm also not 100% familiar with the fancy shmancy aspects of the
AREs, although I am quite familiar with more traditional regular
expressions. This might not be completely true with AREs, but if the
goal for the first example is to leave you with simply "STATE
CIRCLE", then there is no way to use a regular expression on their to
get rid of the nested brackets, as regular expressions refer only to
sequences of characters, and not structure of or relationships
between the subexpressions.
If you know that there are never spaces in the inner brackets, and
that you will have at most two levels of brackets to deal with, you
could put two StringReplaces in sequence:
1. The first transformer replaces patterns like "[(][^ ]*[)]" with ""
2. The second transformer replaces patterns like "[(][^)]*[)]" with ""
The first transformer will remove any "inner brackets", and the
second removes any bracketed expressions that remain. (Note that I
am using expressions like "[(]" to match the special characters; you
could use "\\(" instead if you preferred, but a simple "\(" doesn't
work because something in the user interface seems to reinterpret
what you typed as "(" in this case. The "[(]" notation works both in
workbench dialogs and anywhere else you might be using regular
expressions.)
-g
For insights into what's up at Safe Software and what's on the development
horizon, visit Safe's blog at spatial-etl.blogspot.com.
Safe Software has also made slides available that outline enhancements planned
for FME 2007. The slides are from the "Road Ahead" presentation given on Day 2
of the FME Worldwide Users Conference. To view these slides, visit
www.safe.com/2006uc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/fme/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/fme/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/