Discussion:
[OT] Esoteric RegEx Code Examples
Chuck Pelto
2007-02-10 17:54:36 UTC
Permalink
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?

Regards,

Chuck
Bill Marcy
2007-02-10 17:56:45 UTC
Permalink
http://www.rblibrary.com has a couple of great articles.
Post by Chuck Pelto
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?
Regards,
Chuck
_______________________________________________
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>.
Mark Davis
2007-02-10 23:07:09 UTC
Permalink
Hi Chuck,

I've found the RB Doco for RegEx to be good, but if something isn't in it,
then you can always go to the 'source' of RB's RegEx.

http://www.pcre.org/

If you follow the documentation link to the text file version of the pcre
man page, i suggest scrolling down to the Backslash section, specifically
"Non-printing characters" section for your escape code.

- Mark
Post by Chuck Pelto
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?
Regards,
Chuck
_______________________________________________
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>.
Jack Dolby
2007-02-11 10:46:06 UTC
Permalink
You might look at <http://regexlib.com/default.aspx>

jack
Post by Chuck Pelto
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?
Regards,
Chuck
_______________________________________________
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>.
--
Ask me about the VB Master class at
<http://www.franklins.net>
Charles Yeomans
2007-02-11 15:56:12 UTC
Permalink
Post by Chuck Pelto
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.

Charles Yeomans
Ed Shuler
2007-02-11 16:38:24 UTC
Permalink
Try
http://wiki.tcl.tk/989
http://www.lugaru.com/man/Regular.Expression.Examples.html
http://www.silverstones.com/thebat/Regex.html

es
Post by Charles Yeomans
Post by Chuck Pelto
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.
Charles Yeomans
_______________________________________________
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>.
Ed Shuler
"Unix for power; Macintosh for productivity; Windows for solitaire"
Chuck Pelto
2007-02-12 16:16:38 UTC
Permalink
Morning Charles,
Post by Charles Yeomans
Post by Chuck Pelto
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

Loading...