tags:

views:

53

answers:

1

Hi Guys,

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:

^\'*GO

but its match the quote sysbol?

EOF:

WHERE     (dbo.Property.Archived <> 1)
'
GO
+1  A: 

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.

Babak Ghahremanpour
Ah thats working a treat thank you very much.
Farhan
@Farhan: Then you should accept Babak's answer
Jan Goyvaerts