RegEx pattern matching can also be used in replacement scenarios. Similar to above, more useful in RegExReplace() scenarios. Match preceding character zero or more times Pass through any employeeId claims that contain start with at least one “0”
Match preceding character one or more times Pass through any role claims that contain “Seattle” followed by “Manager” regardless of case. Pass through any role claims that start with “director” regardless of case Pass through any role claims that start with “director” or “manager” Pass through any email claims that end with “” Pass through any role claims that start with “director” Used ones, but there are good resources available online that go into more detail.įor those of you unfamiliar with RegEx, let’s first look at some common RegEx metacharacters used to build pattern templates and what the result would be when using them. Using RegEx to pattern match is accomplished by changing the standard double equals “=” to “=~” and by using special metacharacters in the condition statement. This to control which claims are passed through, and even manipulate the data inside the claims. RegEx uses pattern matching to look at a string with more precision. Most of the time this is sufficient but what if you need to search or replace based on a pattern? Say you want to search for strings that simply start with a particular word. Without RegEx, when we do comparisons or replacements we must look for an exact match. The use of RegEx allows us to search or manipulate data in many ways in order to get a desired result.