mucar,
I've taken a look at the pl/sql syntax for a string literal (http://download.oracle.com/docs/cd/B12037_01/appdev.101/b10807/02_funds.htm#i16004) and the full 'rule' is rather complicated as you can define your own delimiters that allow you to include singe quotes within your string.
The 'trivial' solution is to ignore this type of string literal and either use lyndar's soution, or:
' [^']* '
(I am assuming the 'ignore cases' option is on - otherwise remove the spaces in the pattern).
Just as an exercise, and probably going WAY beyond what you are looking for, I have found what I think is a pattern that will allow for the specially delimited strings as described in the web page referenced above:
# Match the initial single quote
'
# The next bit checks for a special delimiter, [ { < or ( which is matched with ] } > or )
# Alternatively, allow for any other punctuation character which will match itself
(?<FirstChar>
(?<C1>\[)
|
(?<C2>{)
|
(?<C3><)
|
(?<C4>\()
|
(?<Cn>[\p{P}])
)?
# If we are dealing with a special delimiter, then match anything except the ending pattern
(
(?(FirstChar)
(
(?(C1) (?!]') .
|
(?(C2) (?!}') .
|
(?(C3) (?!>') .
|
(?(C4) (?!\)') .
|
(?(Cn) (?!\k<Cn>') .
)
)
)
)
)
)
# If we are not dealing with a special delimiter, then allow either two consecutive single quotes or any non-single quote character
|
(
[^']
|
''
)
)
)*
# Check for any special delimiter trailing pattern and match with the 'partner' character
(?(FirstChar)
(
(?(C1)\]
|
(?(C2)}
|
(?(C3)>
|
(?(C4) \)
|
(?(Cn) \k<Cn>
)
)
)
)
)
)
)
#and/or the final single quote
'
What this does is explained a bit in the comments. It's a mess, but it also seems to work with the limited testing I've done. Note that it also allows strings to be split over two or more lines, but that is in line with my reading of the pl/sql spec: it specifically mentions that carriage returns and line feeds are 'characters' and any 'character' can occur between the single quotes. Changing the [^'] to [^\r\n'] would fix that if necessary.
As for the single line comments, your regex would appear to be adequate, but see my comments later on about the order of your expression matching
Lyndar's comment about the multi-line match is the easiest way to go.
You need to be a bit careful about the order in which you do your string matching and understand what you are going to do with the matches once you have them. If you are replacing the text with something else ( blanks or deleting the text altogether), then to overcome the 'comment in the string' (and the 'string in the comment') issue, if you find all comments and then look for all strings you will be OK. Otherwise you will need to get a bit more complicated to exclude comments in strings - it can be done, but you will need to look at your overall goals for that.
Hope this helps
Susan