# What is regex for blank line in Julia?

**URL:** <https://discourse.julialang.org/t/what-is-regex-for-blank-line-in-julia/102230>\
**Category:** General Usage\
**Tags:** strings, regex\
**Created:** [July 29, 2023, 12:07pm UTC](https://discourse.julialang.org/t/what-is-regex-for-blank-line-in-julia/102230 "2023-07-29T12:07:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [July 29, 2023, 12:07pm UTC](https://discourse.julialang.org/t/what-is-regex-for-blank-line-in-julia/102230/1 "2023-07-29T12:07:18Z")

</div>

What is regular expression for Blank Line in Julia?

> **[Regular expression](https://en.wikipedia.org/wiki/Regular_expression)**
>
> A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation. Regular expression techniques are developed in theoretical computer science and formal language theory.
> The concept of regular expressions began in the 1950s, when the American mathematician ...

---

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [July 29, 2023, 12:16pm UTC](https://discourse.julialang.org/t/what-is-regex-for-blank-line-in-julia/102230/2 "2023-07-29T12:16:13Z")

</div>

I found this regular expression `r"^(?:[\t]*(?:\r?\n|\r))+"m` for blank line. Please write other easy alternatives if you know. 🪂

---

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [July 29, 2023, 12:36pm UTC](https://discourse.julialang.org/t/what-is-regex-for-blank-line-in-julia/102230/3 "2023-07-29T12:36:55Z")

</div>

This may no answer your question, but this website [regex101: build, test, and debug regex](https://regex101.com/), is very useful to test regex expressions.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [July 29, 2023, 2:15pm UTC](https://discourse.julialang.org/t/what-is-regex-for-blank-line-in-julia/102230/4 "2023-07-29T14:15:58Z")

</div>

I would use `r"^$`" to find empty lines, and `r"^\s*$"` to include non-empty lines that contain only whitespace.
