Skip to main content
Solved

Syntax FindRegEX


cprhamel
Contributor
Forum|alt.badge.img+1

Hello everyone

I try to extracted from a character string the end of a block separated by a /

for example _temp / resources / temp / 2017072_email / 12-680-RER @FindRegEx (@Value (_temp), /, - 1 ,,) I can not find the right syntax to look for the character / starting from the right And then cut the block with a @right at the position of the / thank you for your comeback

Best answer by ebygomm

Try with regex [^\\/]*$ so @FindRegEx(@Value(filename),[^\\/]*$)

 

Using the regex in a stringsearcher is an easier way to return the value than using findregex and then cutting the string though

View original
Did this help you find an answer to your question?

5 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • August 1, 2017

Hi @cprhamel,

In your case i used the transformer AttributeSplitter to split in " / ". After a list attribute is created:

You can get the last list attribute: _list{4}.

Thanks


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • August 1, 2017
danilo_fme wrote:

Hi @cprhamel,

In your case i used the transformer AttributeSplitter to split in " / ". After a list attribute is created:

You can get the last list attribute: _list{4}.

Thanks

Continue with transformer ListElementCounter to get the number of lists created.

 

 

With ExpessionEvaluator @value(_element_count) - 1 ) get dynamic mode the last List number.

 

 

The AttributeManager it mapped the the value to new Attribute Last_element = @Value(_list{@Value(_result)}).

 

 

Attached the template file.

 

 

Thanks,

 

Danilo - workspace-list.fmwt

 

 

 


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • Best Answer
  • August 1, 2017

Try with regex [^\\/]*$ so @FindRegEx(@Value(filename),[^\\/]*$)

 

Using the regex in a stringsearcher is an easier way to return the value than using findregex and then cutting the string though


takashi
Evangelist
  • August 1, 2017

If your goal is to extract the last part (i.e. "12-680-RER") from the slash separated string, you can use the @ReplaceRegEx with this setting.

@ReplaceRegEx(@Value(_temp),.+/\s*(.+?)$,\1)

cprhamel
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • August 2, 2017

Thank you for your answers

They work well

 

I will use that egomm to stay in my usual schema

Can you explain to me the set of code used For later use Thank you all for your cooperation

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