4

I considered posting this on Stack Overflow, but I figure this question is more about English syntax than programming rules for it.

So, currently I have this:

$fancyquote = preg_replace('/"\b(.*?\b.?)(?:"|$)/m','“$1”',$input);

What this basically does is look for a (straight) quote that comes right before a word character (letter, number or underscore), followed by the string in the quote, and ending with either the end of a line, or another straight quote.

So this will work with:

The man said "Hello!"
"This is a whole line"

and this:

"I am going to talk for a long time, and tell the story of my life all the way until today, but I could also tell you about today if you like.
"Or maybe not. Let me just get on with it."

But not this:

x = x' + x"

Are there any other rules for quotes in use for dialogue that I have missed?

2 Answers2

2

You are going to have trouble with people who use a straight double quote as an abbreviation either for seconds, or for inches.

  • "He's 5'11" tall," she remarked.
  • Bill explained, "I can't believe he ran the race in just 2'30"!"
  • Sue's mom said, "I was at 38d 54' 48.59" north by 107d 1' 39.05" west when I took the 'shot'."

Or with the other kind of quote:

  • 'He's 5'11" tall,' she remarked.
  • Bill explained, 'I can't believe he ran the race in just 2'30"!'
  • Sue's mom said, 'I was at 38d 54' 48.59" north by 107d 1' 39.05" west when I took the "shot".'

Besides your original posting of using primes in math, the only other example I can think of is people who use prime and double-prime for stress marks, like saying any of these, depending on the “system” they’ve chosen:

  • ar tic' u la" tion
  • ar tic" u la' tion
  • ar 'tic u "la tion
  • ar "tic u 'la tion

All of these are better done in Unicode, where you can say things like

  • Sue’s mom said, “I was at 38° 54′ 48.59″ north by 107° 1′ 39.05″ west when I took the ‘shot’.”
  • Sue’s mom said, ‘I was at 38° 54′ 48.59″ north by 107° 1′ 39.05″ west when I took the “shot”.’

And have it actually come out right. But if you are converting ASCII, there are just going to be errors sometimes.

tchrist
  • 134,759
1

The question is "Are there any other rules for quotes in use for dialogue that I have missed?"

Yes. In the case of nested quotes, matched single quotes should be used for the innermost text. For example, if one wants to quote a passage of text that consists partially, but not entirely of dialogue, this would be the proper punctuation:

"'Is there - is there balm in Gilead? - tell me - tell me, I implore!'  
         Quoth the raven, `Nevermore.'"

or this news headline, freshly posted by The Wall Street Journal a few moments ago (if I were to want to quote it):

"Justices Probe 'Alien Tort' Law"

This is proper usage in the U.S. and Canada. It is familiar to me. British and Australian usage may be different, such that the roles of single and double quotation marks are reversed. In other words, use double quotation marks on the nested text, and single quote marks to enclose the entire passage. In the example above, that would be:

'"Is there – is there balm in Gilead? – tell me – tell me, I implore!"
         Quoth the Raven "Nevermore."'

and similarly

'Justices Probe "Alien Tort" Law'

The choice of quotation marks for nesting is not a hard and fast rule though. It is sufficient as long as usage is consistent, and observes either form of nesting.