# Expression function split anomaly

**URL:** <https://forum.inductiveautomation.com/t/expression-function-split-anomaly/91257>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 3, 2024, 1:36am UTC](https://forum.inductiveautomation.com/t/expression-function-split-anomaly/91257 "2024-06-03T01:36:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 3, 2024, 1:36am UTC](https://forum.inductiveautomation.com/t/expression-function-split-anomaly/91257/1 "2024-06-03T01:36:55Z")

</div>

Been meaning to ask this for a while, but there's a weird quirk when using `split` with filepaths with "" path separators where you have to use `"\\\\"` as the split text instead of just `"\\"` (noting that "" is the escape character, so the first one escapes the second resulting in a literal "". "\\" however would result in literal "\")

e.g.

```python
split("c:\a\b\c\name.txt", "\\") # doesn't work
split("c:\a\b\c\name.txt", "\\\\") # does work

```

the former gives:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/6/06265ca78ae203ee9e4ee16579818a931bd43faa.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 3, 2024, 11:43am UTC](https://forum.inductiveautomation.com/t/expression-function-split-anomaly/91257/2 "2024-06-03T11:43:03Z")

</div>

Because backslashes are escape characters for the string constant **and** escape characters within regular expression syntax. So they have to be doubled in the raw string for each parser. Not an anomaly.

Microsoft's choice of the backslash as a directory separator back in the DOS days was seen back then as a "[expletive] you" to Unix. And is biting their own [expletive] now-a-days, along with their users' [expletive]s. Just say "NO" to Microsoft.
