Skip to main content
Question

FindRegEx - Going backwards

  • September 26, 2019
  • 3 replies
  • 6 views

"FindRegEx(str, regExp, [startIdx], [caseSensitive], [-1])

... If 

-1 
is specified, 
FindRegEx()
 returns the index in 
str 
starting at 
startIdx
 from the end of 
str 
going backwards."

 

I cannot make the backwards search work. Did I do anything wrong?

0684Q00000ArAkeQAF.png 

Tried with Desktop 2019 and 2018. It worked in the past as I remember.

 

3 replies

takashi
Influencer
  • September 26, 2019

I think it's a bug on the function or the documentation. I remember that I reported the inconsistency to Safe support four years ago, am surprised the issue is still outstanding.

Forgot the case number, but I found out this workspace which I sent to Safe in order to describe the issue at that time.

FindRegEx_b15539.fmw: created with FME 2015 build 15539, run with FME 2019.1.2

Hope someone from Safe clarifies this. @danatsafe


fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • September 30, 2019
takashi wrote:

I think it's a bug on the function or the documentation. I remember that I reported the inconsistency to Safe support four years ago, am surprised the issue is still outstanding.

Forgot the case number, but I found out this workspace which I sent to Safe in order to describe the issue at that time.

FindRegEx_b15539.fmw: created with FME 2015 build 15539, run with FME 2019.1.2

0684Q00000ArLseQAF.png

Hope someone from Safe clarifies this. @danatsafe

@takashi Unfortunately the current doc is misleading.  FindRegEx can't search backwards but the start of the forward search can be set from the end (counting backwards).  @jingking If you expect FindRegEx to return 0 for 12345L, then instead try

@Evaluate(@StringLength(12345L)-1-@FindRegEx(12345L,L))

  • Author
  • September 30, 2019
fmelizard wrote:

@takashi Unfortunately the current doc is misleading.  FindRegEx can't search backwards but the start of the forward search can be set from the end (counting backwards).  @jingking If you expect FindRegEx to return 0 for 12345L, then instead try

@Evaluate(@StringLength(12345L)-1-@FindRegEx(12345L,L))

Thanks for the clarification. That makes sense. 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings