Forum Discussion
DavidSho
Apr 24, 2020Copper Contributor
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...
- Apr 26, 2020
\ 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 )
CliveWatson
Apr 26, 2020Former Employee
\ 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 )
- DavidShoApr 29, 2020Copper ContributorTHANK YOU !!!