Morning Charles,

On Feb 11, 2007, at 8:56 AM, Charles Yeomans wrote:


On Feb 10, 2007, at 12:54 PM, Chuck Pelto wrote:

Greetings,

Where can I find a good site to go to for advice on how to code a RegEx request that will allow for double-quotation marks while excluding any that are preceded by a symbol indicating an ESCAPE character?


I'd suggest the REALbasic mailing lists. We'd need a little more information about the regular expression you're trying to write.

I'm trying to write a RegEx call that will identify text between pairs of doube-quotation marks, excluding any such mark that is preceded by an ESCAPE character. The ESCAPE character, for the sake of discussion, is the backwards slash (\) character.

Therefore, in a string of text from and EditField that reads as follows:

This is a test by "Chuck Pelto" for "Susan Pelto" done in "\"Olde\" English"

It would find the following items:

[1] "Chuck Pelto"
[2] "Susan Pelto"
[3] ""Olde" English"

I've got the part of getting the stuff between double-quotation marks working. It reads as follows:

  // method to test aspects of Regular Expressions

  dim rg as New RegEx
  dim theMatch as RegExMatch

  dim strInput as string
  dim strQuots as string
  dim srchPatt as string

  dim iCount as integer
  dim i as integer

  iCount = 0

  strInput = EditField1.text

srchPatt = chr(34) + ".*?" + chr(34) // HERE is the pattern that looks for text between double-quotation marks in a non-greedy manner

  rg.SearchPattern = srchPatt

  theMatch = rg.Search(strInput)

  while theMatch<> nil
    iCount = iCount + 1
    strQuots = theMatch.subExpressionString(0)
    theMatch = rg.search()
  wend



What I need now is to figure out how to get it to exclude double- quotation marks that are preceded by the ESCAPE character (\).

I'm learning how to do this using TextWrangler.

I'm toying around with the following variation on the basic search pattern.....

  srchPatt = chr(34) + ".*?" + chr(34) + "[^(\")]"

Do you think THAT would work?

Regards,

Chuck



_______________________________________________
Unsubscribe:
<[EMAIL PROTECTED]>

REAL Software has decided to consolidate this mailing list with the online Forums.  
On Monday, February 12, 2007, this mailing list will no longer be active.  We 
encourage you to continue your REALbasic and REAL SQL Server discussions on the 
Forums.  If you are not presently a member of the forum, please sign up today at 
<http://forums.realsoftware.com>.

Reply via email to