# Empty range has first element, bug or feature?

**URL:** <https://discourse.julialang.org/t/empty-range-has-first-element-bug-or-feature/105236>\
**Category:** General Usage\
**Created:** [October 20, 2023, 12:56pm UTC](https://discourse.julialang.org/t/empty-range-has-first-element-bug-or-feature/105236 "2023-10-20T12:56:42Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [October 20, 2023, 2:57pm UTC](https://discourse.julialang.org/t/empty-range-has-first-element-bug-or-feature/105236/7 "2023-10-20T14:57:43Z")

</div>

It’s pretty important because it allows you to return useful information from searches where the result is an empty range, because the start of the range tells you the location. For example, searching for word boundaries returns an empty range that has a location:

```julia
julia> findnext(r"\b", "foo bar", 2)
4:3

```

---

_[View the full topic](https://discourse.julialang.org/t/empty-range-has-first-element-bug-or-feature/105236)._
