Skip to main content

Hi,

I tried to find letter after period and capitalize it using StringReplacer but it did not work. Is it possible to accomplish such a thing with the StringReplacer? For example: Condition: good. ensure continuous maintenance. The result should be like this: Condition: good. Ensure continuous maintenance.

 

Text to Replace: (^:a]|\. ]a-z])

Replacement txt: .\U$1 also \U\1 won’t work.

 

Thanks

Leida

Hi Leida, I haven't got the /U$1 approach to work either. I used a StringSearcher to get the first letter after a period in an attribute (with RegEx: (?<=\. )[a-z]), and a StringConcatenator switched to Advanced mode with the following Expression:

@ReplaceRegularExpression(@Value(test),(?<=\. )[a-z],@UpperCase(@Value(_first_match)))

Notice the same RegEx in the String Expression.

 

Hope this helps!


Hi Leida, I haven't got the /U$1 approach to work either. I used a StringSearcher to get the first letter after a period in an attribute (with RegEx: (?<=\. )[a-z]), and a StringConcatenator switched to Advanced mode with the following Expression:

@ReplaceRegularExpression(@Value(test),(?<=\. )[a-z],@UpperCase(@Value(_first_match)))

Notice the same RegEx in the String Expression.

 

Hope this helps!

Great


It appears \1 cannot be modified.

Original Text Condition: good. ensure continuous maintenance.
Text To Replace (^[a]|\. [a-z])
Replacement Text xx@UpperCase(\1xx)
Results Condition: goodxx. eXXnsure continuous maintenance.

 


Nice find @geomancer, I also really can't seem to find a way to modify the result from \1.

Although using multiple transformers isn't that bad, this seems like it could be a nice addition to the string functions FME already has! 

 


Reply