At 14:58 -0400 9/6/11, Jefferis Peterson wrote:
>
>^([A-Z0-9]+) (.*) [0-9]+ $
>
>Just curious... A space in the Find field using Grep... Isn't seen is it?
>Like the space before the $ ?
>
>If no spaces are found before or after in your original Find above, does
>that stop the search? IOW, what is the symbol for optional but not
>necessary spaces?
The spaces are treated as part of the expression. You are demanding their
presence to get a hit.
That's more obvious in perl where regular expressions are always quoted,
usually using the / character as the quoting character.
/^([A-Z0-9]+) (.*) [0-9]+ $/
Is what you would use. There are three spaces in it and all are required to get
a hit.
(.*) followed by a space is curious. The * will match the space and demanding a
real space can cause problems with the greedy concept where matches go as far
as possible. (.*?) would turn off the greediness. The ? mark can also be used
to specify an optional character as in ( ?) where those parentheses are not
required unless you want a capture.
Note also that [A-Z] will match only upper case. There are also \d and \w for
matching more general letters and digits.
And I still use the "Regular Expression Bestiary", a chapter in "Programming
Perl" which is another O'Reilly book that's not for geometric readers.
--
Fe++
// \
Fe++ Fe++
| ||
Fe++ Fe++
\\ /
Fe++
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>