I have these org level values:
80 - Operations
90 - Special Assets
27 - NYC Branch
27 - Miami Operations Branch
I want an expression that only uses the first word after the hyphen - character (return the bold value as described above)
I have these org level values:
80 - Operations
90 - Special Assets
27 - NYC Branch
27 - Miami Operations Branch
I want an expression that only uses the first word after the hyphen - character (return the bold value as described above)
Here is the expression you can use to return the first word after the - character.
It’s not pretty because it’s a mix of a regex and a C# string function, but it gets you what you need.
Regex.Replace(OrgLevel1.Description.Substring(OrgLevel1.Description.IndexOf(’-’)+1).Trim().Split()[0], @"[^0-9a-zA-Z\ ]+", “”)
Please keep in mind that we use C# to evaluate our expressions, so any C# expression can be used if you need to modify it.
Here is a expression that will get you the first 2 words of a string (after a specific character)
It’s not a regex, it uses C# LINQ
String.Join(" ", OrgLevel1.Description.Substring(OrgLevel1.Description.IndexOf('-')+1).Trim().Split(' ').Take(2))