Skip to main content
Solved

Syntax FindRegEX

  • August 1, 2017
  • 5 replies
  • 84 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

danilo_fme
Celebrity
Forum|alt.badge.img+52
  • Celebrity
  • 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
Celebrity
Forum|alt.badge.img+52
  • Celebrity
  • 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

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+46
  • 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
Celebrity
  • 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