Scenario:
Example:
Transformation Claim:
=> Issue (Type = http://contoso.com/claims/street, Value = regexreplace (c.Value, "(?<start>^.{1,50}).+$", "${start}"));
Explanation:
We look for any incoming http://contoso.com/claims/streetfull claims. For those we perform an advanced RegExReplace().
Function Format: RegExReplace(string, match syntax, replace syntax)
String: c.Value The string, is the value of a http://contoso.com/claims/streetful claim
Match Syntax: (?<start>^.{1,50}).+$ The match syntax is broken into two major sections. The first section, (?<start>^.{1,50}) , looks for the first 50 characters, and labels it as <start>. The second section, .+$ , matches everything after the first section. This is important, as we need to match everything in order to make the replacement work as needed.
Replace Syntax: ${start}
The match syntax, ${start} , represents the first 50 characters.
Effectively, we have isolated the first 50 characters into a variable, matched the entire string, then replaced the entire string with the variable.