If you want a meaningful answer to the performance question, you need to benchmark both cases.
Regarding readability/maintainability, you can write unreadable code in any language and so you can do with regular expressions. If you write a big one, be sure to use the x
modifier (IgnorePatternWhitespace
in c#) and use comments to build your regex.
A randomly chosen example from one of my past answers in c#
:
MatchCollection result = Regex.Matches
(testingString,
@"
(?<=\$) # Ensure there is a $ before the string
[^|]* # Match any character that is not a |
(?=\|) #Till a | is ahead
"
, RegexOptions.IgnorePatternWhitespace);