Skip to main content

I have two scenarios; In Column A, I need everything before a set of string, and in Column B, I need everything after a set of string, by using StringReplacer. Below is an example of what I am trying to do:

 

COUNTY OF PRINCESTON

REGION COUNTIES OF LAMBERSON

 

Column A:

COUNTY

REGION COUNTIES

 

Column B:

PRINCESTON

LAMBERSON

 

in the StringReplacer, I have the expression

^.*\\ OF for everything before

\\ OF ,*$ for everything after

 

Based on a previous forum https://community.safe.com/s/question/0D54Q000080hTpzSAE/how-can-i-remove-everything-after-in-fme-using-string-replacer

 

image 

The result of this is that there are no changes to the strings, as everything before and after the ' OF ' remained in the columns.

 

Hi @shirley821​ , these expressions could help you. Here, \\b matches boundary of word, \\s* matches zero or more spaces.

.*\\bOF\\b\\s*

\\s*\\bOF\\b.*


Hi @Takashi Iijima​ Thank you so much, It worked like a charm!! I am wondering where can I find out more about these expressions?


Hi @Takashi Iijima​ Thank you so much, It worked like a charm!! I am wondering where can I find out more about these expressions?

You can find many sites regarding regular expressions on the Web, but I would recommend you to visit this site, which contains quick start, tutorial, example, detailed reference etc.

Regular-Expresions.info

Note that there are several regular expression flavors and could be slightly different in syntax and functions amongst them in some parts. See the site above to learn more.

I think FME basically uses the PCRE library but am not sure it's version. Hope someone from Safe clarifies this. @danatsafe​ 


You can find many sites regarding regular expressions on the Web, but I would recommend you to visit this site, which contains quick start, tutorial, example, detailed reference etc.

Regular-Expresions.info

Note that there are several regular expression flavors and could be slightly different in syntax and functions amongst them in some parts. See the site above to learn more.

I think FME basically uses the PCRE library but am not sure it's version. Hope someone from Safe clarifies this. @danatsafe​ 

@takashi Yes, FME uses Qt which is based on the latest PCRE library.


You can find many sites regarding regular expressions on the Web, but I would recommend you to visit this site, which contains quick start, tutorial, example, detailed reference etc.

Regular-Expresions.info

Note that there are several regular expression flavors and could be slightly different in syntax and functions amongst them in some parts. See the site above to learn more.

I think FME basically uses the PCRE library but am not sure it's version. Hope someone from Safe clarifies this. @danatsafe​ 

Thank you for your clarification, @danatsafe​ ​


Reply