Skip to main content
Question

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

  • May 13, 2024
  • 2 replies
  • 231 views

tnarladni
Enthusiast
Forum|alt.badge.img+23

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

 

great solution!