Regex Help matching quotes
I havin a reg ex problemm i would like to have a reg ex that will match the '\nGO at the end of my file(see below.) I have got the following so far:开发者_JAVA百科
^\'*GO
but its match the quote sysbol?
EOF:
WHERE (dbo.Property.Archived <> 1)
'
GO
In Perl \Z matches the end of the string, totally ignoring line breaks. Use this to match GO on the last line of a file if the file is loaded into a string:
^GO\Z
POSIX regex uses \' instead of \Z.
To match exactly the newline and then the word GO in your example, you want this:
\nGO
You can also do this:
\n.*GO
This last regular expression will match what you want in your example, but the .* part will make it so there can be anything (or nothing) in between the newline and GO.
精彩评论