Forum Discussion

DavidSho's avatar
DavidSho
Copper Contributor
Apr 24, 2020
Solved

Escaping parenthesis in regular expression

Hello everyone, I am trying to extract text from the inside of parenthesis in a string. For example:  From this string : Microsoft Office Excel/16.0.11929.20618 (Windows/10.0; Desktop x64; en-IE...
  • CliveWatson's avatar
    Apr 26, 2020

    DavidSho 

     

    \ is a special character so you need two of them "\\", this wont error now, but gets all between the "(" and ")".   e.g. "(Windows/10.0; Desktop x64; en-IE; Desktop app; Dell Inc./XPS 13 9370)"

     

    print t = "Microsoft Office Excel/16.0.11929.20618 (Windows/10.0; Desktop x64; en-IE; Desktop app; Dell Inc./XPS 13 9370)"
    | extend UserDevice = extract('\\(.*\\)', 0, t )

     

     

Resources