Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

concatenate multiple regexes into one regex

Tags:

regex

For a text file, I want to match to the string that starts with "BEAM" and "FILE PATH". I would have used

^BEAM.*$
^FILE PATH.*$

if I were to match them separately. But now I have to concatenate those two matching patterns into one pattern.

Any idea on how to do this?

like image 264
Graviton Avatar asked Dec 06 '22 06:12

Graviton


1 Answers

A pipe/bar character generally represents "or" with regexps. You could try:

^(BEAM|FILE PATH).*$
like image 189
zombat Avatar answered Dec 08 '22 14:12

zombat