I’m working on parsing a text file, running through each line, and I’m having trouble figuring out the Regex. Part of this parsing involves changing occurances such as:
É to é
I’ve tried the following regular expression, but it doesn’t return anything:
/^(?!&)(É)/
Any suggestions?
So you want to match
Éonly if it’s not at the start of the line?Use
(assuming Ruby 1.9 because 1.8 doesn’t support lookbehind)
Rationale:
.matches any character except newline. So if the lookbehind assertion matches, we’re not at the start of the line.