Thanks Bob,
OK. The escape character \ still is active in escaping the next
character or space when inside of triple quotes. So, I guess when the
program is running, since I am not printing these things out, I don't
care if anything in my notes is escaped unless it is a strategic single
or double quote....thus disrupting the bubble of the comment formed by
such triple quotes.
Speaking of single and double quotes, I noticed that I had used two
single ' to surround some things, so I changed them to double quotes so
as not to confuse my triple quotes. Then I noticed that I had also used
contractions with ' apostrophes which would also mess up my comment
bubble, so I got rid of those also. As far as I can tell, the triple
single quotes (''') should work at that point. In fact, they do if I
wrap this whole section in a print( ) statement and paste it into IDLE
SHELL. But! I found as soon as I had IDLE run my script I got the same
error.
Here is where I am at now with this script: (NOTE: I have the final
solution below this listing.)
#!/usr/bin/env python3
'''
Regular Expressions - or at least some
Identifiers:
\d any number
\D anything but a number (digit)
\s space
\S anything but a space
\w any character
\W anything but a character
\. any character (or even a period itself if you use \.) except for a
newline
\a search for just the letter "a"
\b the white space around words
Modifiers
{x} we are expecting "x" number of something
{1, 3} we are expecting 1-3 in length of something -, so for digits we
write \d{1-3}
+ means Match 1 or more
? means Match 0 or 1
* Match 0 or more
$ Match the end of a string
^ Match the beginning of a string
| Match either or - so you might write \d{1-3} | \w{5-6}
[ ] a range or "variance" such as [A-Z] or [A-Za-z] Cap 1st letter
followed by lower case
or [1-5a-qA-Z] starts with a number inclusive of 1-5 then
lower case letter then
followed by any Cap letter! :)
White Space Characters (may not be seen):
\n new line
\s space
\t tab
\e escape
\f form feed
\r return
DO NOT FORGET!:
. + * ? [ ] $ ^ ( ) { } | \ if you really want to use
these, you must escape them
'''
I was not getting a line number for the error because I was running it
only from IDLE and I was looking only at the commented area...as that
now was the only thing left in the script....or was it? It hadn't
occurred to me to try the linux command line. When I called it from the
Linux Console, I got:
[justme@ispy] ~/python_work$ python3 RE-1.py
File "RE-1.py", line 69
^
SyntaxError: EOF while scanning triple-quoted string literal
[justme@ispy] ~/python_work$
Which puzzled me, as I didn't have 69 lines! And guess what I found
when I scrolled down past the end of my script? Way down out of sight
below my program was a single ''' setting down there all by it's
lonesome self! -a fragment of me changing things all over the place
trying to figure out what was going wrong....it had slipped below my
line of sight and with further chances continued to work it's way down
the page.
I think all these fixes...this solves my problem! Thanks for your time
and help! :)
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor