Home

Pattern Match on String Column

Highlighted
Anonymous
Not applicable

Pattern Match on String Column

In many functional programming languages there is a way to do pattern matching, like F# has `match expression with`.

 

In my use case, I'd like to match a string to a set of strings/regexes and returning a value(a string):

 

```

// path:string
iif(path == '/', 'home',
iif(path == '/search', 'search',
iif(path == '/*/*/*-for-sale-*', 'product',
'other',
)))

```

 

The `iif` syntax is really ugly though. Is there a more concise way to find a string match and return a value?

1 Reply

Re: Pattern Match on String Column

Hi,

 

One of the string operators is matches that allow you to perform regular expression matches.

There are also other methods to check regular expressions.

 

Thanks,

Meir

Related Conversations
SPFx Webpart and MSGraphClient
Stefan Kießig in Developer on
0 Replies
Running SPFX WorkBench in SharePoint Online
Daniel Anderson in Developer on
1 Replies
how to implement audience using CSOM?
Srinivas Narula in Developer on
2 Replies
custom user action in SharePoint online
Stefan Kießig in Developer on
2 Replies