The accepted answer is right but you may have redundancy in your Regular Expression.
^
means match the start of a line
(BEAM|FILE PATH)
- means the string "BEAM" or the string "FILE PATH"
.*
means anything at all
$
means match the end of the line
So in effect, all you are saying is match my strings at the beginning of the line since you don't care what's at the end. You could do this with:
^(BEAM|FILE PATH)
There are two cases where this reduction wouldn't be valid:
If you doing some with the matched string, so you want to match the whole line to pass the data to something else.
You're using a Regular Expression function that wants to match a whole string rather than part of it. You can sometimes solve this by picking the a different Regular Expression function or method. For example in Python use search
instead of match
.