Skip to main content
Question

RegEx to get the first letter of each word. Works in search, but not in SubstringRegularExpression


tnarladni
Enthusiast
Forum|alt.badge.img+15

I’m trying to create a new value based on the first letter of each word in a string. I tested the regex ‘\b(\w)’ and the returned value is correct, but when I used that regex in the @SubstringRegularExpression(), it only returned the first letter of the first word.

@SubstringRegularExpression(@Value(ID),\b(\w)) where ID is “MARKHAM RD/ORANGE BLVD, SANDFORD”. You can see in the regex editor, it is correct.

 

This is the result of the substring

 

2 replies

geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 13, 2024

SubstringRegularExpression doesn't work with capture groups, which your regular expression does.

Use a StringSearcher, enter the name of a new list under Advanced, after All Matches List Name. 
This will create a list of all values that meet your regular expression.
Next use a ListConcatenator to join all values of the list in a single variable.

 


danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • May 13, 2024
geomancer wrote:

SubstringRegularExpression doesn't work with capture groups, which your regular expression does.

Use a StringSearcher, enter the name of a new list under Advanced, after All Matches List Name. 
This will create a list of all values that meet your regular expression.
Next use a ListConcatenator to join all values of the list in a single variable.

 

great solution!


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